API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.io. ObjectOutputStream View Source
Author(s)
Mike Warres
Roger Riggs
Since
JDK1.1
Version
1.159, 06/07/25
Serial
Hierarchy
 Object
      OutputStream
          ObjectOutputStream
Implements
 ObjectOutput
 ObjectStreamConstants
Subclasses
Description
public class ObjectOutputStream
  An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream.
Constructors
protected ObjectOutputStream () throws IOException SecurityException
  Provide a way for subclasses that are completely reimplementing ObjectOutputStream to not have to allocate private data just used by this implementation of ObjectOutputStream.
public ObjectOutputStream (OutputStream out) throws IOException
  Creates an ObjectOutputStream that writes to the specified OutputStream.
Methods
Hide/Show inherited methods
protected void annotateClass (Class<Object> cl) throws IOException
  Subclasses may implement this method to allow class data to be stored in the stream.
protected void annotateProxyClass (Class<Object> cl) throws IOException
  Subclasses may implement this method to store custom data in the stream along with descriptors for dynamic proxy classes.
public void close () throws IOException [Overrides OutputStream] [Specified in ObjectOutput]
  Closes the stream.
public void defaultWriteObject () throws IOException
  Write the non-static and non-transient fields of the current class to this stream.
protected void drain () throws IOException
  Drain any buffered data in ObjectOutputStream.
protected boolean enableReplaceObject (boolean enable) throws SecurityException
  Enable the stream to do replacement of objects in the stream.
public void flush () throws IOException [Overrides OutputStream] [Specified in ObjectOutput]
  Flushes the stream.
pack-private int getProtocolVersion ()
Returns protocol version in use.
public PutField putFields () throws IOException
  Retrieve the object used to buffer persistent fields to be written to the stream.
protected Object replaceObject (Object obj) throws IOException
  This method will allow trusted subclasses of ObjectOutputStream to substitute one object for another during serialization.
public void reset () throws IOException
  Reset will disregard the state of any objects already written to the stream.
public void useProtocolVersion (int version) throws IOException
  Specify stream protocol version to use when writing the stream.
public void write (byte[] buf) throws IOException [Overrides OutputStream] [Specified in ObjectOutput]
  Writes an array of bytes.
public void write (byte[] buf, int off, int len) throws IOException [Overrides OutputStream] [Specified in ObjectOutput]
  Writes a sub array of bytes.
public void write (int val) throws IOException [Specified in ObjectOutput]
  Writes a byte.
public void writeBoolean (boolean val) throws IOException
  Writes a boolean.
public void writeByte (int val) throws IOException
  Writes an 8 bit byte.
public void writeBytes (String str) throws IOException
  Writes a String as a sequence of bytes.
public void writeChar (int val) throws IOException
  Writes a 16 bit char.
public void writeChars (String str) throws IOException
  Writes a String as a sequence of chars.
protected void writeClassDescriptor (ObjectStreamClass desc) throws IOException
  Write the specified class descriptor to the ObjectOutputStream.
public void writeDouble (double val) throws IOException
  Writes a 64 bit double.
public void writeFields () throws IOException
  Write the buffered fields to the stream.
public void writeFloat (float val) throws IOException
  Writes a 32 bit float.
public void writeInt (int val) throws IOException
  Writes a 32 bit int.
public void writeLong (long val) throws IOException
  Writes a 64 bit long.
publicfinal void writeObject (Object obj) throws IOException [Specified in ObjectOutput]
  Write the specified object to the ObjectOutputStream.
protected void writeObjectOverride (Object obj) throws IOException
  Method used by subclasses to override the default writeObject method.
public void writeShort (int val) throws IOException
  Writes a 16 bit short.
protected void writeStreamHeader () throws IOException
  The writeStreamHeader method is provided so subclasses can append or prepend their own header to the stream.
pack-private void writeTypeString (String str) throws IOException
  Writes string without allowing it to be replaced in stream.
public void writeUnshared (Object obj) throws IOException
  Writes an "unshared" object to the ObjectOutputStream.
public void writeUTF (String str) throws IOException
  Primitive data write of this String in modified UTF-8 format.
Fields
Hide/Show inherited fields
publicfinalstatic int baseWireHandle = "8257536" [Inherited From ObjectStreamConstants]
First wire handle to be assigned.
publicfinalstatic int PROTOCOL_VERSION_1 = "1" [Inherited From ObjectStreamConstants]
  A Stream Protocol Version.
publicfinalstatic int PROTOCOL_VERSION_2 = "2" [Inherited From ObjectStreamConstants]
  A Stream Protocol Version.
publicfinalstatic byte SC_BLOCK_DATA = "8" [Inherited From ObjectStreamConstants]
  Bit mask for ObjectStreamClass flag.
publicfinalstatic byte SC_ENUM = "16" [Inherited From ObjectStreamConstants]
  Bit mask for ObjectStreamClass flag.
publicfinalstatic byte SC_EXTERNALIZABLE = "4" [Inherited From ObjectStreamConstants]
  Bit mask for ObjectStreamClass flag.
publicfinalstatic byte SC_SERIALIZABLE = "2" [Inherited From ObjectStreamConstants]
  Bit mask for ObjectStreamClass flag.
publicfinalstatic byte SC_WRITE_METHOD = "1" [Inherited From ObjectStreamConstants]
  Bit mask for ObjectStreamClass flag.
publicfinalstatic short STREAM_MAGIC = "-21267" [Inherited From ObjectStreamConstants]
Magic number that is written to the stream header.
publicfinalstatic short STREAM_VERSION = "5" [Inherited From ObjectStreamConstants]
Version number that is written to the stream header.
publicfinalstatic SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION [Inherited From ObjectStreamConstants]
  Enable overriding of readObject and writeObject.
publicfinalstatic SerializablePermission SUBSTITUTION_PERMISSION [Inherited From ObjectStreamConstants]
  Enable substitution of one object for another during serialization/deserialization.
publicfinalstatic byte TC_ARRAY = "117" [Inherited From ObjectStreamConstants]
new Array.
publicfinalstatic byte TC_BASE = "112" [Inherited From ObjectStreamConstants]
First tag value.
publicfinalstatic byte TC_BLOCKDATA = "119" [Inherited From ObjectStreamConstants]
  Block of optional data.
publicfinalstatic byte TC_BLOCKDATALONG = "122" [Inherited From ObjectStreamConstants]
  long Block data.
publicfinalstatic byte TC_CLASS = "118" [Inherited From ObjectStreamConstants]
Reference to Class.
publicfinalstatic byte TC_CLASSDESC = "114" [Inherited From ObjectStreamConstants]
new Class Descriptor.
publicfinalstatic byte TC_ENDBLOCKDATA = "120" [Inherited From ObjectStreamConstants]
End of optional block data blocks for an object.
publicfinalstatic byte TC_ENUM = "126" [Inherited From ObjectStreamConstants]
  new Enum constant.
publicfinalstatic byte TC_EXCEPTION = "123" [Inherited From ObjectStreamConstants]
Exception during write.
publicfinalstatic byte TC_LONGSTRING = "124" [Inherited From ObjectStreamConstants]
Long string.
publicfinalstatic byte TC_MAX = "126" [Inherited From ObjectStreamConstants]
Last tag value.
publicfinalstatic byte TC_NULL = "112" [Inherited From ObjectStreamConstants]
Null object reference.
publicfinalstatic byte TC_OBJECT = "115" [Inherited From ObjectStreamConstants]
new Object.
publicfinalstatic byte TC_PROXYCLASSDESC = "125" [Inherited From ObjectStreamConstants]
new Proxy Class Descriptor.
publicfinalstatic byte TC_REFERENCE = "113" [Inherited From ObjectStreamConstants]
Reference to an object already written into the stream.
publicfinalstatic byte TC_RESET = "121" [Inherited From ObjectStreamConstants]
  Reset stream context.
publicfinalstatic byte TC_STRING = "116" [Inherited From ObjectStreamConstants]
new String.
Nested Classes
  ObjectOutputStream.PutField
Provide programmatic access to the persistent fields to be written to ObjectOutput.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar