Package org.jboss.marshalling
Class ObjectOutputStreamMarshaller
java.lang.Object
org.jboss.marshalling.ObjectOutputStreamMarshaller
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,ObjectOutput,AutoCloseable,ByteOutput,Marshaller
A Marshaller which simply wraps an object stream. Useful for retrofitting and testing applications.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance which wraps the given stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidDiscard the class cache.voidDiscard the instance cache.voidclose()voidfinish()Finish marshalling to a stream.voidflush()voidstart(ByteOutput newOutput) Begin marshalling to a stream.voidwrite(byte[] buf) Write all the bytes from the given array to the stream.voidwrite(byte[] buf, int off, int len) Write some of the bytes from the given array to the stream.voidwrite(int val) Writes to the output stream the eight low-order bits of the argumentb.voidwriteBoolean(boolean val) voidwriteByte(int val) voidwriteBytes(String str) voidwriteChar(int val) voidwriteChars(String str) voidwriteDouble(double val) voidwriteFloat(float val) voidwriteInt(int val) voidwriteLong(long val) voidwriteObject(Object obj) voidWrite an object to the underlying storage or stream as a new instance.voidwriteShort(int val) void
-
Constructor Details
-
ObjectOutputStreamMarshaller
Construct a new instance which wraps the given stream.- Parameters:
oos- the object stream to wrap
-
-
Method Details
-
writeObject
- Specified by:
writeObjectin interfaceObjectOutput- Throws:
IOException
-
write
Writes 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 interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Parameters:
val- the byte to write- Throws:
IOException- if an error occurs
-
write
Write all the bytes from the given array to the stream.- Specified by:
writein interfaceByteOutput- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Parameters:
buf- the byte array- Throws:
IOException- if an error occurs
-
write
Write some of the bytes from the given array to the stream.- Specified by:
writein interfaceByteOutput- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Parameters:
buf- the byte arrayoff- the index to start writing fromlen- the number of bytes to write- Throws:
IOException- if an error occurs
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceObjectOutput- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceObjectOutput- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
writeByte
- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeShort
- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeChar
- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeInt
- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeFloat
- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeDouble
- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChars
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeUTF
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-
start
Begin marshalling to a stream.- Specified by:
startin interfaceMarshaller- Parameters:
newOutput- the new stream- Throws:
IOException- if an error occurs during setup, such as an error writing the header
-
clearInstanceCache
Discard 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:
IOException- if an error occurs
-
clearClassCache
Discard the class cache. Implicitly also discards the instance cache.- Specified by:
clearClassCachein interfaceMarshaller- Throws:
IOException- if an error occurs
-
finish
Finish 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:
IOException- if an error occurs
-