/[classpath]/classpath/java/io/ObjectOutputStream.java
ViewVC logotype

Diff of /classpath/java/io/ObjectOutputStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by mkoch, Fri Mar 28 13:00:09 2003 UTC revision 1.34 by mkoch, Wed Jun 25 11:29:44 2003 UTC
# Line 224  public class ObjectOutputStream extends Line 224  public class ObjectOutputStream extends
224                }                }
225    
226              if (obj instanceof ObjectStreamClass)              if (obj instanceof ObjectStreamClass)
227                {                writeClassDescriptor ((ObjectStreamClass) obj);
                 ObjectStreamClass osc = (ObjectStreamClass)obj;  
                 realOutput.writeByte (TC_CLASSDESC);  
                 realOutput.writeUTF (osc.getName ());  
                 realOutput.writeLong (osc.getSerialVersionUID ());  
                 assignNewHandle (obj);  
   
                 int flags = osc.getFlags ();  
   
                 if (protocolVersion == PROTOCOL_VERSION_2  
                     && osc.isExternalizable ())  
                   flags |= SC_BLOCK_DATA;  
   
                 realOutput.writeByte (flags);  
   
                 ObjectStreamField[] fields = osc.fields;  
                 realOutput.writeShort (fields.length);  
   
                 ObjectStreamField field;  
                 for (int i=0; i < fields.length; i++)  
                   {  
                     field = fields[i];  
                     realOutput.writeByte (field.getTypeCode ());  
                     realOutput.writeUTF (field.getName ());  
   
                     if (! field.isPrimitive ())  
                       writeObject (field.getTypeString ());  
                   }  
   
                 boolean oldmode = setBlockDataMode (true);  
                 annotateClass (osc.forClass ());  
                 setBlockDataMode (oldmode);  
                 realOutput.writeByte (TC_ENDBLOCKDATA);  
   
                 if (osc.isSerializable ())  
                   writeObject (osc.getSuper ());  
                 else  
                   writeObject (null);  
                 break;  
               }  
228    
229              if ((replacementEnabled || obj instanceof Serializable)              if ((replacementEnabled || obj instanceof Serializable)
230                  && ! replaceDone)                  && ! replaceDone)
# Line 406  public class ObjectOutputStream extends Line 367  public class ObjectOutputStream extends
367        }        }
368    }    }
369    
370      protected void writeClassDescriptor (ObjectStreamClass osc) throws IOException
371      {
372        realOutput.writeByte (TC_CLASSDESC);
373        realOutput.writeUTF (osc.getName ());
374        realOutput.writeLong (osc.getSerialVersionUID ());
375        assignNewHandle (osc);
376    
377        int flags = osc.getFlags ();
378    
379        if (protocolVersion == PROTOCOL_VERSION_2
380            && osc.isExternalizable ())
381          flags |= SC_BLOCK_DATA;
382    
383        realOutput.writeByte (flags);
384    
385        ObjectStreamField[] fields = osc.fields;
386        realOutput.writeShort (fields.length);
387    
388        ObjectStreamField field;
389        for (int i=0; i < fields.length; i++)
390          {
391            field = fields[i];
392            realOutput.writeByte (field.getTypeCode ());
393            realOutput.writeUTF (field.getName ());
394    
395            if (! field.isPrimitive ())
396              writeObject (field.getTypeString ());
397          }
398    
399        boolean oldmode = setBlockDataMode (true);
400        annotateClass (osc.forClass ());
401        setBlockDataMode (oldmode);
402        realOutput.writeByte (TC_ENDBLOCKDATA);
403    
404        if (osc.isSerializable ())
405          writeObject (osc.getSuper ());
406        else
407          writeObject (null);
408      }
409      
410    /**    /**
411       Writes the current objects non-transient, non-static fields from       Writes the current objects non-transient, non-static fields from
412       the current class to the underlying output stream.       the current class to the underlying output stream.

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26