xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "TJ Teegan" <tjtee...@hotmail.com>
Subject Problems Serializing a SVGDocument
Date Mon, 13 Dec 2004 15:15:50 GMT
Hello,

I am trying to serialize a SVGDocument using the following code:

public byte[] convertObjectToBytes(Object o){
        byte[] bytes;
        ObjectOutputStream oos;
        ByteArrayOutputStream byteStreamOut;

        //object o must implement the Serializable interface
        bytes = new byte[0];
        try{
            //write the object to a bit stream
            byteStreamOut = new ByteArrayOutputStream();
            oos = new ObjectOutputStream(byteStreamOut);
            oos.writeObject(o);
            bytes = byteStreamOut.toByteArray();
        }catch(IOException e){
            e.printStackTrace();
        }
        return bytes;
    }

I call the method like this:
byte[] b = convertObjectToBytes(svgCanvas.getSVGDocument()):

I get the following error:
java.io.NotSerializableException: org.apache.batik.css.engine.StyleMap
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
        at 
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
        at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
        at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
        at 
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
        at apt.onRequest.net.NetIO.convertObjectToBytes(NetIO.java:66)
        at apt.onRequest.gui.DrawingPanel.testSave(DrawingPanel.java:2192)
        at apt.onRequest.gui.DrawingPanel.zoomIn(DrawingPanel.java:282)
        at 
apt.onRequest.gui.MainScreen.btnZoomInActionPerformed(MainScreen.java:471)
        at apt.onRequest.gui.MainScreen.access$700(MainScreen.java:17)
        at 
apt.onRequest.gui.MainScreen$8.actionPerformed(MainScreen.java:200)
        at 
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
        at 
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
        at 
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at 
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at 
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
        at 
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
        at java.awt.Component.processMouseEvent(Component.java:5100)
        at java.awt.Component.processEvent(Component.java:4897)
        at java.awt.Container.processEvent(Container.java:1569)
        at java.awt.Component.dispatchEventImpl(Component.java:3615)
        at java.awt.Container.dispatchEventImpl(Container.java:1627)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at 
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
        at 
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
        at java.awt.Container.dispatchEventImpl(Container.java:1613)
        at java.awt.Window.dispatchEventImpl(Window.java:1606)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
        at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Is there anyway around this error?  I apologize if this already been 
covered.  I searched the mailing list archives, but could not find an 
answer.  Any help is greatly appreciated.

Thank you,
TJ Teegan

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message