public class ObjectOutputStream extends DataOutputStream
Streamable objects to an OutputStream. Other common object types
are supported as well: Boolean, Byte, Character, Short, Integer, Long, Float, Double,
boolean[], byte[], char[], short[], int[], long[], float[], double[], Object[].Streamable| Constructor and Description |
|---|
ObjectOutputStream(OutputStream target)
Constructs an object output stream which will write its data to the supplied target stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTranslation(String className,
String streamedName)
Configures this object output stream with a mapping from a classname to a streamed name.
|
void |
defaultWriteObject()
Uses the default streamable mechanism to write the contents of the object currently being
streamed.
|
void |
writeBareObject(Object object)
Writes a
Streamable instance or one of the support object types without
associated class metadata to the output stream. |
void |
writeIntern(String value)
Writes a pooled string value to the output stream.
|
void |
writeObject(Object object)
Writes a
Streamable instance or one of the support object types to the output
stream. |
void |
writeUnmodifiedUTF(String str)
Write a string encoded as real UTF-8 (rather than the modified format handled by
{link #writeUTF}).
|
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFclose, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwritepublic ObjectOutputStream(OutputStream target)
public void addTranslation(String className, String streamedName)
public void writeObject(Object object) throws IOException
Streamable instance or one of the support object types to the output
stream.IOExceptionpublic void writeIntern(String value) throws IOException
IOExceptionpublic void writeBareObject(Object object) throws IOException
Streamable instance or one of the support object types without
associated class metadata to the output stream. The caller is responsible for knowing
the exact class of the written object, creating an instance of such and calling ObjectInputStream.readBareObject(Object) to read its data from the stream.object - the object to be written. It cannot be null.IOExceptionpublic void defaultWriteObject()
throws IOException
writeObject implementation in a
Streamable object.IOExceptionpublic void writeUnmodifiedUTF(String str) throws IOException
IOExceptionCopyright © 2015. All rights reserved.