Package org.jboss.marshalling.serial
Class BlockMarshaller
- java.lang.Object
-
- org.jboss.marshalling.serial.BlockMarshaller
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataOutput,java.io.Flushable,java.io.ObjectOutput,java.io.ObjectStreamConstants,java.lang.AutoCloseable,ByteOutput,Marshaller,ExtendedObjectStreamConstants
public final class BlockMarshaller extends java.lang.Object implements Marshaller, ExtendedObjectStreamConstants
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]bufferprivate intpositionprivate SerialMarshallerserialMarshaller-
Fields inherited from interface org.jboss.marshalling.serial.ExtendedObjectStreamConstants
TC_CLASSTABLEDESC, TC_OBJECTTABLE
-
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 Constructor Description BlockMarshaller(SerialMarshaller marshaller, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearClassCache()Discard the class cache.voidclearInstanceCache()Discard the instance cache.voidclose()private voiddoWriteObject(java.lang.Object obj, boolean unshared)voidfinish()Finish marshalling to a stream.voidflush()voidstart(ByteOutput newOutput)Begin marshalling to a stream.voidwrite(byte[] b)Write all the bytes from the given array to the stream.voidwrite(byte[] bytes, int off, int len)Write some of the bytes from the given array to the stream.voidwrite(int v)Writes to the output stream the eight low-order bits of the argumentb.voidwriteBoolean(boolean v)voidwriteByte(int v)voidwriteBytes(java.lang.String s)voidwriteChar(int v)voidwriteChars(java.lang.String s)voidwriteDouble(double v)voidwriteFloat(float v)voidwriteInt(int v)voidwriteLong(long v)voidwriteObject(java.lang.Object obj)voidwriteObjectUnshared(java.lang.Object obj)Write an object to the underlying storage or stream as a new instance.voidwriteShort(int v)voidwriteUTF(java.lang.String s)
-
-
-
Field Detail
-
serialMarshaller
private final SerialMarshaller serialMarshaller
-
buffer
private final byte[] buffer
-
position
private int position
-
-
Constructor Detail
-
BlockMarshaller
BlockMarshaller(SerialMarshaller marshaller, int bufferSize)
-
-
Method Detail
-
start
public void start(ByteOutput newOutput) throws java.io.IOException
Description copied from interface:MarshallerBegin marshalling to a stream.- Specified by:
startin interfaceMarshaller- Parameters:
newOutput- the new stream- Throws:
java.io.IOException- if an error occurs during setup, such as an error writing the header
-
clearInstanceCache
public void clearInstanceCache() throws java.io.IOExceptionDescription copied from interface:MarshallerDiscard the instance cache. May also discard the class cache in implementations that do not support separated class and instance caches.- Specified by:
clearInstanceCachein interfaceMarshaller- Throws:
java.io.IOException- if an error occurs
-
clearClassCache
public void clearClassCache() throws java.io.IOExceptionDescription copied from interface:MarshallerDiscard the class cache. Implicitly also discards the instance cache.- Specified by:
clearClassCachein interfaceMarshaller- Throws:
java.io.IOException- if an error occurs
-
finish
public void finish() throws java.io.IOExceptionDescription copied from interface:MarshallerFinish marshalling to a stream. Any transient class or instance cache is discarded. The stream is released. No further marshalling may be done until theMarshaller.start(ByteOutput)method is again invoked.- Specified by:
finishin interfaceMarshaller- Throws:
java.io.IOException- if an error occurs
-
writeObject
public void writeObject(java.lang.Object obj) throws java.io.IOException- Specified by:
writeObjectin interfacejava.io.ObjectOutput- Throws:
java.io.IOException
-
writeObjectUnshared
public void writeObjectUnshared(java.lang.Object obj) throws java.io.IOExceptionDescription copied from interface:MarshallerWrite an object to the underlying storage or stream as a new instance. The class that implements this interface defines how the object is written.- Specified by:
writeObjectUnsharedin interfaceMarshaller- Parameters:
obj- the object to be written- Throws:
java.io.IOException- if an error occurs
-
doWriteObject
private void doWriteObject(java.lang.Object obj, boolean unshared) throws java.io.IOException- Throws:
java.io.IOException
-
write
public void write(int v) throws java.io.IOExceptionDescription copied from interface:ByteOutputWrites to the output stream the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.- Specified by:
writein interfaceByteOutput- Specified by:
writein interfacejava.io.DataOutput- Specified by:
writein interfacejava.io.ObjectOutput- Parameters:
v- the byte to write- Throws:
java.io.IOException- if an error occurs
-
write
public void write(byte[] b) throws java.io.IOExceptionDescription copied from interface:ByteOutputWrite all the bytes from the given array to the stream.- Specified by:
writein interfaceByteOutput- Specified by:
writein interfacejava.io.DataOutput- Specified by:
writein interfacejava.io.ObjectOutput- Parameters:
b- the byte array- Throws:
java.io.IOException- if an error occurs
-
write
public void write(byte[] bytes, int off, int len) throws java.io.IOExceptionDescription copied from interface:ByteOutputWrite some of the bytes from the given array to the stream.- Specified by:
writein interfaceByteOutput- Specified by:
writein interfacejava.io.DataOutput- Specified by:
writein interfacejava.io.ObjectOutput- Parameters:
bytes- the byte arrayoff- the index to start writing fromlen- the number of bytes to write- Throws:
java.io.IOException- if an error occurs
-
writeBoolean
public void writeBoolean(boolean v) throws java.io.IOException- Specified by:
writeBooleanin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeByte
public void writeByte(int v) throws java.io.IOException- Specified by:
writeBytein interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeShort
public void writeShort(int v) throws java.io.IOException- Specified by:
writeShortin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeChar
public void writeChar(int v) throws java.io.IOException- Specified by:
writeCharin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeInt
public void writeInt(int v) throws java.io.IOException- Specified by:
writeIntin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeLong
public void writeLong(long v) throws java.io.IOException- Specified by:
writeLongin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeFloat
public void writeFloat(float v) throws java.io.IOException- Specified by:
writeFloatin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeDouble
public void writeDouble(double v) throws java.io.IOException- Specified by:
writeDoublein interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeBytes
public void writeBytes(java.lang.String s) throws java.io.IOException- Specified by:
writeBytesin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeChars
public void writeChars(java.lang.String s) throws java.io.IOException- Specified by:
writeCharsin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
writeUTF
public void writeUTF(java.lang.String s) throws java.io.IOException- Specified by:
writeUTFin interfacejava.io.DataOutput- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin interfacejava.io.ObjectOutput- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.io.ObjectOutput- Throws:
java.io.IOException
-
-