Package org.jboss.marshalling
Class MarshallingObjectOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.ObjectOutputStream
-
- org.jboss.marshalling.MarshallingObjectOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.io.ObjectOutput
,java.io.ObjectStreamConstants
,java.lang.AutoCloseable
public final class MarshallingObjectOutputStream extends java.io.ObjectOutputStream
An object output stream which wraps aMarshaller
, which may be used by legacyObjectOutputStream
-based applications that wish to use the marshalling framework.
-
-
Field Summary
Fields Modifier and Type Field Description private Marshaller
marshaller
-
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
MarshallingObjectOutputStream(Marshaller marshaller, ByteOutput byteOutput)
Construct a new instance that delegates to the given marshaller.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
annotateClass(java.lang.Class<?> cl)
protected void
annotateProxyClass(java.lang.Class<?> cl)
void
close()
void
defaultWriteObject()
protected void
drain()
protected boolean
enableReplaceObject(boolean enable)
void
flush()
java.io.ObjectOutputStream.PutField
putFields()
protected java.lang.Object
replaceObject(java.lang.Object obj)
void
reset()
void
useProtocolVersion(int version)
void
write(byte[] buf)
void
write(byte[] buf, int off, int len)
void
write(int val)
void
writeBoolean(boolean val)
void
writeByte(int val)
void
writeBytes(java.lang.String str)
void
writeChar(int val)
void
writeChars(java.lang.String str)
protected void
writeClassDescriptor(java.io.ObjectStreamClass desc)
void
writeDouble(double val)
void
writeFields()
void
writeFloat(float val)
void
writeInt(int val)
void
writeLong(long val)
protected void
writeObjectOverride(java.lang.Object obj)
void
writeShort(int val)
protected void
writeStreamHeader()
void
writeUnshared(java.lang.Object obj)
void
writeUTF(java.lang.String str)
-
-
-
Field Detail
-
marshaller
private Marshaller marshaller
-
-
Constructor Detail
-
MarshallingObjectOutputStream
protected MarshallingObjectOutputStream(Marshaller marshaller, ByteOutput byteOutput) throws java.io.IOException, java.lang.SecurityException
Construct a new instance that delegates to the given marshaller.- Parameters:
marshaller
- the delegate marshaller- Throws:
java.io.IOException
- if an I/O error occursjava.lang.SecurityException
- if the caller does not have permission to construct an instance of this class
-
-
Method Detail
-
writeObjectOverride
protected void writeObjectOverride(java.lang.Object obj) throws java.io.IOException
- Overrides:
writeObjectOverride
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeUnshared
public void writeUnshared(java.lang.Object obj) throws java.io.IOException
- Overrides:
writeUnshared
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
write
public void write(int val) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in interfacejava.io.ObjectOutput
- Overrides:
write
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] buf) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in interfacejava.io.ObjectOutput
- Overrides:
write
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] buf, int off, int len) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in interfacejava.io.ObjectOutput
- Overrides:
write
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in interfacejava.io.ObjectOutput
- Overrides:
flush
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeBoolean
public void writeBoolean(boolean val) throws java.io.IOException
- Specified by:
writeBoolean
in interfacejava.io.DataOutput
- Overrides:
writeBoolean
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeByte
public void writeByte(int val) throws java.io.IOException
- Specified by:
writeByte
in interfacejava.io.DataOutput
- Overrides:
writeByte
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeShort
public void writeShort(int val) throws java.io.IOException
- Specified by:
writeShort
in interfacejava.io.DataOutput
- Overrides:
writeShort
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeChar
public void writeChar(int val) throws java.io.IOException
- Specified by:
writeChar
in interfacejava.io.DataOutput
- Overrides:
writeChar
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeInt
public void writeInt(int val) throws java.io.IOException
- Specified by:
writeInt
in interfacejava.io.DataOutput
- Overrides:
writeInt
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeLong
public void writeLong(long val) throws java.io.IOException
- Specified by:
writeLong
in interfacejava.io.DataOutput
- Overrides:
writeLong
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeFloat
public void writeFloat(float val) throws java.io.IOException
- Specified by:
writeFloat
in interfacejava.io.DataOutput
- Overrides:
writeFloat
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeDouble
public void writeDouble(double val) throws java.io.IOException
- Specified by:
writeDouble
in interfacejava.io.DataOutput
- Overrides:
writeDouble
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeBytes
public void writeBytes(java.lang.String str) throws java.io.IOException
- Specified by:
writeBytes
in interfacejava.io.DataOutput
- Overrides:
writeBytes
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeChars
public void writeChars(java.lang.String str) throws java.io.IOException
- Specified by:
writeChars
in interfacejava.io.DataOutput
- Overrides:
writeChars
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeUTF
public void writeUTF(java.lang.String str) throws java.io.IOException
- Specified by:
writeUTF
in interfacejava.io.DataOutput
- Overrides:
writeUTF
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
reset
public final void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
close
public final void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejava.io.ObjectOutput
- Overrides:
close
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
useProtocolVersion
public final void useProtocolVersion(int version) throws java.io.IOException
- Overrides:
useProtocolVersion
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
annotateClass
protected final void annotateClass(java.lang.Class<?> cl) throws java.io.IOException
- Overrides:
annotateClass
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
annotateProxyClass
protected final void annotateProxyClass(java.lang.Class<?> cl) throws java.io.IOException
- Overrides:
annotateProxyClass
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
replaceObject
protected final java.lang.Object replaceObject(java.lang.Object obj) throws java.io.IOException
- Overrides:
replaceObject
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
enableReplaceObject
protected final boolean enableReplaceObject(boolean enable) throws java.lang.SecurityException
- Overrides:
enableReplaceObject
in classjava.io.ObjectOutputStream
- Throws:
java.lang.SecurityException
-
writeStreamHeader
protected final void writeStreamHeader() throws java.io.IOException
- Overrides:
writeStreamHeader
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeClassDescriptor
protected final void writeClassDescriptor(java.io.ObjectStreamClass desc) throws java.io.IOException
- Overrides:
writeClassDescriptor
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
drain
protected final void drain() throws java.io.IOException
- Overrides:
drain
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
writeFields
public void writeFields() throws java.io.IOException
- Overrides:
writeFields
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
putFields
public java.io.ObjectOutputStream.PutField putFields() throws java.io.IOException
- Overrides:
putFields
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
defaultWriteObject
public void defaultWriteObject() throws java.io.IOException
- Overrides:
defaultWriteObject
in classjava.io.ObjectOutputStream
- Throws:
java.io.IOException
-
-