ObjectOutputStream class

 

                  Also see serialization.

 

ObjectOutputStream has these methods because it implements DataOutput:

 

 

Plus it has these methods because it extends OutputStream:

write( int ) - Writes the eight low-order bits of an int.

write( byte[ ] ) - Writes all the bytes in a byte array.

write( byte[ ], offset, len ) - Writes len  from a byte array starting at offset.

writeBoolean( boolean ) - Writes a one-byte boolean value.

writeByte( int ) - Acts the same as write( int b ) above

writeBytes( String ) - Writes low order bytes of all the chars in a String.

writeChar( int ) - Writes a two-byte char value from the low end of an int.

writeChars( String ) - Writes two char bytes of all the chars in a String.

writeDouble( double ) - Writes an eight-byte double value.

writeFloat( float ) - Writes a four-byte float value.

writeInt( int ) - Writes a four-byte int value.

writeLong( long ) - Writes an eight-byte long value.

writeShort( int ) - Writes two byte short value from low end of an int.

writeUTF( String ) - Writes a String in special modified UTF format

write( int b )  - Writes a single byte, supplied as the low-order byte in an int.

write( byte[ ] )   - Writes an array of bytes.

write( byte[ ], offset, len )   - Writes portion len of a byte array, from offset

close( )  - Closes the stream, flushing it first.

flush( )  - Flushes all associated buffers in a stream without closing it.

 

 

  Object serialization is used for Java Remote Method Invocation (RMI) and JavaBeans, neither of which is demonstrated on this site.  Subsequently, only simple examples of storing and retrieving objects are provided here.  See serialization.