java.io.Serializable .
This class is not part of the marshalling API; rather it is intended for marshaller implementers to make it easier to develop Java serialization-compatible marshallers.
| Modifier and Type | Field and Description |
|---|---|
| private final Marshaller |
| Access | Constructor and Description |
|---|---|
| protected | MarshallerObjectOutputStream(final Marshaller
the delegate marshaller output)Construct a new instance that delegates to the given marshaller. |
| Modifier and Type | Method and Description |
|---|---|
| protected final void | annotateClass(final Class<?>
the class to annotate custom data for cl)Overrides java. |
| protected final void | annotateProxyClass(final Class<?>
the proxy class to annotate custom data for cl)
Subclasses may implement this method to store custom data in the stream
along with descriptors for dynamic proxy classes.
|
| public final void | close()
Overrides java. Implements java. |
| public abstract void | defaultWriteObject()
Write the non-static and non-transient fields of the current class to
this stream.
|
| protected final void | |
| protected final boolean | enableReplaceObject(final boolean
true for enabling use of enable)
Enables the stream to do replacement of objects written to the stream.
replaceObject for
every object being serialized |
| public void | flush()
Overrides java. Implements java. |
| public abstract ObjectOutputStream. | putFields()
Overrides java. |
| protected final Object | replaceObject(final Object
the object to be replaced obj)Overrides java. |
| public final void | reset()
Overrides java. |
| public final void | useProtocolVersion(final int
use ProtocolVersion from java.io.ObjectStreamConstants. version)
Specify stream protocol version to use when writing the stream.
|
| public void | write(final int
the byte to write val)Overrides java. Implements org. b.
|
| public void | write(final byte[]
the byte array buf)Overrides java. Implements org. |
| public void | write(final byte[]
the byte array buf, final int the index to start writing from off, final int the number of bytes to write len)Overrides java. Implements org. |
| public void | writeBoolean(final boolean
the boolean to be written val)Overrides java. Implements java. |
| public void | writeByte(final int
the byte value to be written val)Overrides java. Implements java. |
| public void | writeBytes(final String
the String of bytes to be written str)Overrides java. Implements java. |
| public void | writeChar(final int
the char value to be written val)Overrides java. Implements java. |
| public void | writeChars(final String
the String of chars to be written str)Overrides java. Implements java. |
| protected final void | writeClassDescriptor(final ObjectStreamClass
class descriptor to write to the stream desc)
Write the specified class descriptor to the ObjectOutputStream.
|
| public void | writeDouble(final double
the double value to be written val)Overrides java. Implements java. |
| public abstract void | writeFields()
Overrides java. |
| public void | writeFloat(final float
the float value to be written val)Overrides java. Implements java. |
| public void | writeInt(final int
the integer value to be written val)Overrides java. Implements java. |
| public void | writeLong(final long
the long value to be written val)Overrides java. Implements java. |
| protected void | writeObjectOverride(final Object
object to be written to the underlying stream obj)
Method used by subclasses to override the default writeObject method.
|
| public void | writeShort(final int
the short value to be written val)Overrides java. Implements java. |
| protected final void | writeStreamHeader()
Overrides java. |
| public void | writeUnshared(final Object
object to write to stream obj)Overrides java. |
| public void | writeUTF(final String
the String to be written str)Overrides java. Implements java. |
| output | back to summary |
|---|---|
| private final Marshaller output | |
| MarshallerObjectOutputStream | back to summary |
|---|---|
| protected MarshallerObjectOutputStream(final Marshaller output) throws IOException, SecurityException Construct a new instance that delegates to the given marshaller.
| |
| annotateClass | back to summary |
|---|---|
| protected final void annotateClass(final Class<?> cl) throws IOException Overrides java. Doc from java. Subclasses may implement this method to allow class data to be stored in the stream. By default this method does nothing. The corresponding method in ObjectInputStream is resolveClass. This method is called exactly once for each unique class in the stream. The class name and signature will have already been written to the stream. This method may make free use of the ObjectOutputStream to save any representation of the class it deems suitable (for example, the bytes of the class file). The resolveClass method in the corresponding subclass of ObjectInputStream must read and use any data or objects written by annotateClass.
| |
| annotateProxyClass | back to summary |
|---|---|
| protected final void annotateProxyClass(final Class<?> cl) throws IOException Overrides java. Doc from java. Subclasses may implement this method to store custom data in the stream along with descriptors for dynamic proxy classes. This method is called exactly once for each unique proxy class
descriptor in the stream. The default implementation of this method in
The corresponding method in
| |
| close | back to summary |
|---|---|
| public final void close() throws IOException Overrides java. Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| defaultWriteObject | back to summary |
|---|---|
| public abstract void defaultWriteObject() throws IOException Overrides java. Doc from java. Write the non-static and non-transient fields of the current class to this stream. This may only be called from the writeObject method of the class being serialized. It will throw the NotActiveException if it is called otherwise.
| |
| drain | back to summary |
|---|---|
| protected final void drain() throws IOException Overrides java. Doc from java. Drain any buffered data in ObjectOutputStream. Similar to flush but does not propagate the flush to the underlying stream.
| |
| enableReplaceObject | back to summary |
|---|---|
| protected final boolean enableReplaceObject(final boolean enable) throws SecurityException Overrides java. Doc from java. Enables the stream to do replacement of objects written to the stream. When
enabled, the If object replacement is currently not enabled, and
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes this stream by writing any buffered output to the underlying stream.
| |
| putFields | back to summary |
|---|---|
| public abstract ObjectOutputStream. Overrides java. Doc from java. Retrieve the object used to buffer persistent fields to be written to the stream. The fields will be written to the stream when writeFields method is called.
| |
| replaceObject | back to summary |
|---|---|
| protected final Object replaceObject(final Object obj) throws IOException Overrides java. Doc from java. This method will allow trusted subclasses of ObjectOutputStream to substitute one object for another during serialization. Replacing objects is disabled until enableReplaceObject is called. The enableReplaceObject method checks that the stream requesting to do replacement can be trusted. The first occurrence of each object written into the serialization stream is passed to replaceObject. Subsequent references to the object are replaced by the object returned by the original call to replaceObject. To ensure that the private state of objects is not unintentionally exposed, only trusted streams may use replaceObject. The ObjectOutputStream.writeObject method takes a parameter of type Object (as opposed to type Serializable) to allow for cases where non-serializable objects are replaced by serializable ones. When a subclass is replacing objects it must ensure that either a complementary substitution must be made during deserialization or that the substituted object is compatible with every field where the reference will be stored. Objects whose type is not a subclass of the type of the field or array element abort the serialization by raising an exception and the object is not be stored. This method is called only once when each object is first encountered. All subsequent references to the object will be redirected to the new object. This method should return the object to be substituted or the original object. Null can be returned as the object to be substituted, but may cause
| |
| reset | back to summary |
|---|---|
| public final void reset() throws IOException Overrides java. Doc from java. Reset will disregard the state of any objects already written to the stream. The state is reset to be the same as a new ObjectOutputStream. The current point in the stream is marked as reset so the corresponding ObjectInputStream will be reset at the same point. Objects previously written to the stream will not be referred to as already being in the stream. They will be written to the stream again.
| |
| useProtocolVersion | back to summary |
|---|---|
| public final void useProtocolVersion(final int version) throws IOException Overrides java. Doc from java. Specify stream protocol version to use when writing the stream. This routine provides a hook to enable the current version of Serialization to write in a format that is backwards compatible to a previous version of the stream format. Every effort will be made to avoid introducing additional backwards incompatibilities; however, sometimes there is no other alternative.
| |
| write | back to summary |
|---|---|
| public void write(final int val) throws IOException Overrides java. Implements org. Doc from org. Writes to the output stream the eight low-order bits of the argument
| |
| write | back to summary |
|---|---|
| public void write(final byte[] buf) throws IOException Overrides java. Implements org. Doc from org. Write all the bytes from the given array to the stream.
| |
| write | back to summary |
|---|---|
| public void write(final byte[] buf, final int off, final int len) throws IOException Overrides java. Implements org. Doc from org. Write some of the bytes from the given array to the stream.
| |
| writeBoolean | back to summary |
|---|---|
| public void writeBoolean(final boolean val) throws IOException Overrides java. Implements java. Doc from java. Writes a boolean.
| |
| writeByte | back to summary |
|---|---|
| public void writeByte(final int val) throws IOException Overrides java. Implements java. Doc from java. Writes an 8-bit byte.
| |
| writeBytes | back to summary |
|---|---|
| public void writeBytes(final String str) throws IOException Overrides java. Implements java. Doc from java. Writes a String as a sequence of bytes.
| |
| writeChar | back to summary |
|---|---|
| public void writeChar(final int val) throws IOException Overrides java. Implements java. Doc from java. Writes a 16-bit char.
| |
| writeChars | back to summary |
|---|---|
| public void writeChars(final String str) throws IOException Overrides java. Implements java. Doc from java. Writes a String as a sequence of chars.
| |
| writeClassDescriptor | back to summary |
|---|---|
| protected final void writeClassDescriptor(final ObjectStreamClass desc) throws IOException Overrides java. Doc from java. Write the specified class descriptor to the ObjectOutputStream. Class
descriptors are used to identify the classes of objects written to the
stream. Subclasses of ObjectOutputStream may override this method to
customize the way in which class descriptors are written to the
serialization stream. The corresponding method in ObjectInputStream,
Note that this method will only be called if the ObjectOutputStream
is not using the old serialization stream format (set by calling
ObjectOutputStream's
| |
| writeDouble | back to summary |
|---|---|
| public void writeDouble(final double val) throws IOException Overrides java. Implements java. Doc from java. Writes a 64-bit double.
| |
| writeFields | back to summary |
|---|---|
| public abstract void writeFields() throws IOException Overrides java. Doc from java. Write the buffered fields to the stream.
| |
| writeFloat | back to summary |
|---|---|
| public void writeFloat(final float val) throws IOException Overrides java. Implements java. Doc from java. Writes a 32-bit float.
| |
| writeInt | back to summary |
|---|---|
| public void writeInt(final int val) throws IOException Overrides java. Implements java. Doc from java. Writes a 32-bit int.
| |
| writeLong | back to summary |
|---|---|
| public void writeLong(final long val) throws IOException Overrides java. Implements java. Doc from java. Writes a 64-bit long.
| |
| writeObjectOverride | back to summary |
|---|---|
| protected void writeObjectOverride(final Object obj) throws IOException Overrides java. Doc from java. Method used by subclasses to override the default writeObject method. This method is called by trusted subclasses of ObjectOutputStream that constructed ObjectOutputStream using the protected no-arg constructor. The subclass is expected to provide an override method with the modifier "final".
| |
| writeShort | back to summary |
|---|---|
| public void writeShort(final int val) throws IOException Overrides java. Implements java. Doc from java. Writes a 16-bit short.
| |
| writeStreamHeader | back to summary |
|---|---|
| protected final void writeStreamHeader() throws IOException Overrides java. Doc from java. The writeStreamHeader method is provided so subclasses can append or prepend their own header to the stream. It writes the magic number and version to the stream.
| |
| writeUnshared | back to summary |
|---|---|
| public void writeUnshared(final Object obj) throws IOException Overrides java. Doc from java. Writes an "unshared" object to the ObjectOutputStream. This method is identical to writeObject, except that it always writes the given object as a new, unique object in the stream (as opposed to a back-reference pointing to a previously serialized instance). Specifically:
ObjectOutputStream subclasses which override this method can only be constructed in security contexts possessing the "enableSubclassImplementation" SerializablePermission; any attempt to instantiate such a subclass without this permission will cause a SecurityException to be thrown.
| |
| writeUTF | back to summary |
|---|---|
| public void writeUTF(final String str) throws IOException Overrides java. Implements java. Doc from java. Primitive data write of this String in modified UTF-8 format. Note that there is a significant difference between writing a String into the stream as primitive data or as an Object. A String instance written by writeObject is written into the stream as a String initially. Future writeObject() calls write references to the string into the stream.
| |