@ThreadSafe @Deprecated public interface StreamingMarshaller extends Marshaller
Marshaller
that supports streams.
A single instance of any implementation is shared by multiple threads, so implementations need to be threadsafe,
and preferably immutable.Marshaller
Modifier and Type | Method and Description |
---|---|
void |
finishObjectInput(ObjectInput oi)
Deprecated.
Finish using the given ObjectInput.
|
void |
finishObjectOutput(ObjectOutput oo)
Deprecated.
Finish using the given ObjectOutput.
|
Object |
objectFromInputStream(InputStream is)
Deprecated.
Unmarshall an object from an
InputStream |
Object |
objectFromObjectStream(ObjectInput in)
Deprecated.
Unmarshalls an object from an
ObjectInput |
void |
objectToObjectStream(Object obj,
ObjectOutput out)
Deprecated.
Marshalls an object to a given
ObjectOutput |
void |
start()
Deprecated.
Perform any initialization required before the marshaller is used.
|
ObjectInput |
startObjectInput(InputStream is,
boolean isReentrant)
Deprecated.
Create and open a new ObjectInput for the given input stream.
|
ObjectOutput |
startObjectOutput(OutputStream os,
boolean isReentrant,
int estimatedSize)
Deprecated.
Create and open an ObjectOutput instance for the given output stream.
|
void |
stop()
Deprecated.
Stop the marshaller.
|
getBufferSizePredictor, initialize, isMarshallable, mediaType, objectFromByteBuffer, objectFromByteBuffer, objectToBuffer, objectToByteBuffer, objectToByteBuffer
ObjectOutput startObjectOutput(OutputStream os, boolean isReentrant, int estimatedSize) throws IOException
Create and open an ObjectOutput instance for the given output stream. This method should be used for opening data outputs when multiple objectToObjectStream() calls will be made before the stream is closed by calling finishObjectOutput().
This method also takes a boolean that represents whether this particular call to startObjectOutput() is reentrant or not. A call to startObjectOutput() should be marked reentrant whenever a 2nd or more calls to this method are made without having called finishObjectOutput() first.
To potentially speed up calling startObjectOutput multiple times in a non-reentrant way, i.e. startObjectOutput/finishObjectOutput...startObjectOutput/finishObjectOutput...etc, which is is the most common case, the StreamingMarshaller implementation could potentially use some mechanisms to speed up this startObjectOutput call.
On the other hand, when a call is reentrant, i.e. startObjectOutput/startObjectOutput(reentrant)...finishObjectOutput/finishObjectOutput, the StreamingMarshaller implementation might treat it differently. An example of reentrancy would be marshalling of MarshalledValue. When sending or storing a MarshalledValue, a call to startObjectOutput() would occur so that the stream is open and following, a 2nd call could occur so that MarshalledValue's raw byte array version is calculated and sent across. This enables storing as binary on the receiver side which is performance gain. The StreamingMarshaller implementation could decide that it needs a separate ObjectOutput or similar for the 2nd call since it's aim is only to get the raw byte array version and the close finish with it.
os
- output streamisReentrant
- whether the call is reentrant or not.estimatedSize
- estimated size in bytes of the output. Only meant as a possible performance optimization.IOException
void finishObjectOutput(ObjectOutput oo)
oo
- data output that finished usingvoid objectToObjectStream(Object obj, ObjectOutput out) throws IOException
ObjectOutput
obj
- object to marshallout
- stream to marshall toIOException
ObjectInput startObjectInput(InputStream is, boolean isReentrant) throws IOException
Create and open a new ObjectInput for the given input stream. This method should be used for opening data inputs when multiple objectFromObjectStream() calls will be made before the stream is closed.
This method also takes a boolean that represents whether this particular call to startObjectInput() is reentrant or not. A call to startObjectInput() should be marked reentrant whenever a 2nd or more calls to this method are made without having called finishObjectInput() first.
To potentially speed up calling startObjectInput multiple times in a non-reentrant way, i.e. startObjectInput/finishObjectInput...startObjectInput/finishObjectInput...etc, which is is the most common case, the StreamingMarshaller implementation could potentially use some mechanisms to speed up this startObjectInput call.
is
- input streamisReentrant
- whether the call is reentrant or not.IOException
void finishObjectInput(ObjectInput oi)
oi
- data input that finished usingObject objectFromObjectStream(ObjectInput in) throws IOException, ClassNotFoundException, InterruptedException
ObjectInput
in
- stream to unmarshall fromIOException
- if unmarshalling cannot complete due to some I/O errorClassNotFoundException
- if the class of the object trying to unmarshall is unknownInterruptedException
- if the unmarshalling was interrupted. Clients should take this as a sign that
the marshaller is no longer available, maybe due to shutdown, and so no more unmarshalling should be attempted.Object objectFromInputStream(InputStream is) throws IOException, ClassNotFoundException
InputStream
is
- stream to unmarshall fromIOException
- if unmarshalling cannot complete due to some I/O errorClassNotFoundException
- if the class of the object trying to unmarshall is unknownvoid stop()
stop
in interface Marshaller
void start()
Marshaller
start
in interface Marshaller
Copyright © 2021 JBoss by Red Hat. All rights reserved.