Package org.jboss.marshalling
Class MarshallerObjectOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ObjectOutputStream
-
- org.jboss.marshalling.MarshallerObjectOutputStream
-
- All Implemented Interfaces:
Closeable
,DataOutput
,Flushable
,ObjectOutput
,ObjectStreamConstants
,AutoCloseable
,ByteOutput
public abstract class MarshallerObjectOutputStream extends ObjectOutputStream implements ByteOutput
A marshaller's object output stream. Used by marshallers for compatibility with Java serialization. Instances of this class may be passed in to the overridden serialization methods for a class implementingSerializable
.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.io.ObjectOutputStream
ObjectOutputStream.PutField
-
-
Field Summary
-
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, SERIAL_FILTER_PERMISSION, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MarshallerObjectOutputStream(Marshaller output)
Construct a new instance that delegates to the given marshaller.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
annotateClass(Class<?> cl)
protected void
annotateProxyClass(Class<?> cl)
void
close()
abstract void
defaultWriteObject()
protected void
drain()
protected boolean
enableReplaceObject(boolean enable)
void
flush()
abstract ObjectOutputStream.PutField
putFields()
protected Object
replaceObject(Object obj)
void
reset()
void
useProtocolVersion(int version)
void
write(byte[] buf)
Write all the bytes from the given array to the stream.void
write(byte[] buf, int off, int len)
Write some of the bytes from the given array to the stream.void
write(int val)
Writes to the output stream the eight low-order bits of the argumentb
.void
writeBoolean(boolean val)
void
writeByte(int val)
void
writeBytes(String str)
void
writeChar(int val)
void
writeChars(String str)
protected void
writeClassDescriptor(ObjectStreamClass desc)
void
writeDouble(double val)
abstract void
writeFields()
void
writeFloat(float val)
void
writeInt(int val)
void
writeLong(long val)
protected void
writeObjectOverride(Object obj)
void
writeShort(int val)
protected void
writeStreamHeader()
void
writeUnshared(Object obj)
void
writeUTF(String str)
-
Methods inherited from class java.io.ObjectOutputStream
writeObject
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
MarshallerObjectOutputStream
protected MarshallerObjectOutputStream(Marshaller output) throws IOException, SecurityException
Construct a new instance that delegates to the given marshaller.- Parameters:
output
- the delegate marshaller- Throws:
IOException
- if an I/O error occursSecurityException
- if the caller does not have permission to construct an instance of this class
-
-
Method Detail
-
writeObjectOverride
protected void writeObjectOverride(Object obj) throws IOException
- Overrides:
writeObjectOverride
in classObjectOutputStream
- Throws:
IOException
-
writeUnshared
public void writeUnshared(Object obj) throws IOException
- Overrides:
writeUnshared
in classObjectOutputStream
- Throws:
IOException
-
write
public void write(int val) throws IOException
Writes to the output stream the eight low-order bits of the argumentb
. The 24 high-order bits ofb
are ignored.- Specified by:
write
in interfaceByteOutput
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Overrides:
write
in classObjectOutputStream
- Parameters:
val
- the byte to write- Throws:
IOException
- if an error occurs
-
write
public void write(byte[] buf) throws IOException
Write all the bytes from the given array to the stream.- Specified by:
write
in interfaceByteOutput
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Overrides:
write
in classObjectOutputStream
- Parameters:
buf
- the byte array- Throws:
IOException
- if an error occurs
-
write
public void write(byte[] buf, int off, int len) throws IOException
Write some of the bytes from the given array to the stream.- Specified by:
write
in interfaceByteOutput
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Overrides:
write
in classObjectOutputStream
- Parameters:
buf
- the byte arrayoff
- the index to start writing fromlen
- the number of bytes to write- Throws:
IOException
- if an error occurs
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfaceObjectOutput
- Overrides:
flush
in classObjectOutputStream
- Throws:
IOException
-
writeBoolean
public void writeBoolean(boolean val) throws IOException
- Specified by:
writeBoolean
in interfaceDataOutput
- Overrides:
writeBoolean
in classObjectOutputStream
- Throws:
IOException
-
writeByte
public void writeByte(int val) throws IOException
- Specified by:
writeByte
in interfaceDataOutput
- Overrides:
writeByte
in classObjectOutputStream
- Throws:
IOException
-
writeShort
public void writeShort(int val) throws IOException
- Specified by:
writeShort
in interfaceDataOutput
- Overrides:
writeShort
in classObjectOutputStream
- Throws:
IOException
-
writeChar
public void writeChar(int val) throws IOException
- Specified by:
writeChar
in interfaceDataOutput
- Overrides:
writeChar
in classObjectOutputStream
- Throws:
IOException
-
writeInt
public void writeInt(int val) throws IOException
- Specified by:
writeInt
in interfaceDataOutput
- Overrides:
writeInt
in classObjectOutputStream
- Throws:
IOException
-
writeLong
public void writeLong(long val) throws IOException
- Specified by:
writeLong
in interfaceDataOutput
- Overrides:
writeLong
in classObjectOutputStream
- Throws:
IOException
-
writeFloat
public void writeFloat(float val) throws IOException
- Specified by:
writeFloat
in interfaceDataOutput
- Overrides:
writeFloat
in classObjectOutputStream
- Throws:
IOException
-
writeDouble
public void writeDouble(double val) throws IOException
- Specified by:
writeDouble
in interfaceDataOutput
- Overrides:
writeDouble
in classObjectOutputStream
- Throws:
IOException
-
writeBytes
public void writeBytes(String str) throws IOException
- Specified by:
writeBytes
in interfaceDataOutput
- Overrides:
writeBytes
in classObjectOutputStream
- Throws:
IOException
-
writeChars
public void writeChars(String str) throws IOException
- Specified by:
writeChars
in interfaceDataOutput
- Overrides:
writeChars
in classObjectOutputStream
- Throws:
IOException
-
writeUTF
public void writeUTF(String str) throws IOException
- Specified by:
writeUTF
in interfaceDataOutput
- Overrides:
writeUTF
in classObjectOutputStream
- Throws:
IOException
-
reset
public final void reset() throws IOException
- Overrides:
reset
in classObjectOutputStream
- Throws:
IOException
-
close
public final void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceObjectOutput
- Overrides:
close
in classObjectOutputStream
- Throws:
IOException
-
useProtocolVersion
public final void useProtocolVersion(int version) throws IOException
- Overrides:
useProtocolVersion
in classObjectOutputStream
- Throws:
IOException
-
annotateClass
protected final void annotateClass(Class<?> cl) throws IOException
- Overrides:
annotateClass
in classObjectOutputStream
- Throws:
IOException
-
annotateProxyClass
protected final void annotateProxyClass(Class<?> cl) throws IOException
- Overrides:
annotateProxyClass
in classObjectOutputStream
- Throws:
IOException
-
replaceObject
protected final Object replaceObject(Object obj) throws IOException
- Overrides:
replaceObject
in classObjectOutputStream
- Throws:
IOException
-
enableReplaceObject
protected final boolean enableReplaceObject(boolean enable) throws SecurityException
- Overrides:
enableReplaceObject
in classObjectOutputStream
- Throws:
SecurityException
-
writeStreamHeader
protected final void writeStreamHeader() throws IOException
- Overrides:
writeStreamHeader
in classObjectOutputStream
- Throws:
IOException
-
writeClassDescriptor
protected final void writeClassDescriptor(ObjectStreamClass desc) throws IOException
- Overrides:
writeClassDescriptor
in classObjectOutputStream
- Throws:
IOException
-
drain
protected final void drain() throws IOException
- Overrides:
drain
in classObjectOutputStream
- Throws:
IOException
-
writeFields
public abstract void writeFields() throws IOException
- Overrides:
writeFields
in classObjectOutputStream
- Throws:
IOException
-
putFields
public abstract ObjectOutputStream.PutField putFields() throws IOException
- Overrides:
putFields
in classObjectOutputStream
- Throws:
IOException
-
defaultWriteObject
public abstract void defaultWriteObject() throws IOException
- Overrides:
defaultWriteObject
in classObjectOutputStream
- Throws:
IOException
-
-