java.io.ObjectOutput
java.io.DataOutput
None
java.io.ObjectOutputStream
New as of JDK 1.1
The ObjectOutput interface extends the DataOutput interface for object serialization. While DataOutput defines methods for reading primitive types from a stream, ObjectOutput defines methods for writing objects and arrays of bytes.
public abstract interface java.io.ObjectOutput extends java.io.DataOutput { // Methods public abstract void close(); public abstract void flush(); public abstract void write(int b); public abstract void write(byte[] b); public abstract void write(byte[] b, int off, int len); public abstract void writeObject(Object obj); }
If any kind of I/O error occurs.
This method closes the stream and releases any system resources associated with it.
If any kind of I/O error occurs.
If the stream uses a buffer, this method forces any bytes that may be buffered by the output stream to be written to the underlying physical device.
The value to write.
If any kind of I/O error occurs.
DataOutput.write(int)
This method writes the lowest eight bits of the given integer b to the stream.
An array of bytes to write to the stream.
If any kind of I/O error occurs.
DataOutput.write(byte[])
This method writes all of the 8-bit bytes in the given array to the stream.
public abstract void write(byte[] b, int off, int len) throws IOException
An array of bytes to write to the stream.
An offset into the byte array.
The number of bytes to write.
If any kind of I/O error occurs.
DataOutput.write(byte[], int, int)
This method writes len bytes from the given array, starting off elements from the beginning of the array, to the stream.
If any kind of I/O error occurs.
This method writes the given object to the stream, or in other words, it serializes an object to the stream. The class that implements this interface determines how the object is written.
Method | Inherited From | Method | Inherited From |
---|---|---|---|
writeBoolean(boolean) |
DataOutput |
writeByte(int) |
DataOutput |
writeBytes(String) |
DataOutput |
writeChar(int) |
DataOutput |
writeChars(String) |
DataOutput |
writeDouble(double) |
DataOutput |
writeFloat(float) |
DataOutput |
writeInt(int) |
DataOutput |
writeLong(long) |
DataOutput |
writeShort(int) |
DataOutput |
writeUTF(String) |
DataOutput |
DataOutput, ObjectOutputStream