Interface StreamingMarshaller

All Superinterfaces:
Marshaller
All Known Implementing Classes:
AbstractJBossMarshaller, GenericJBossMarshaller, GlobalMarshaller, JBossMarshaller, JBossUserMarshaller

@ThreadSafe @Deprecated(forRemoval=true) public interface StreamingMarshaller extends Marshaller
Deprecated, for removal: This API element is subject to removal in a future version.
for internal use only
A specialization of Marshaller that supports streams.

A single instance of any implementation is shared by multiple threads, so implementations need to be threadsafe, and preferably immutable.

Since:
4.0
Author:
Manik Surtani, Galder ZamarreƱo
See Also:
  • Method Details

    • startObjectOutput

      ObjectOutput startObjectOutput(OutputStream os, boolean isReentrant, int estimatedSize) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.

      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.

      Parameters:
      os - output stream
      isReentrant - whether the call is reentrant or not.
      estimatedSize - estimated size in bytes of the output. Only meant as a possible performance optimization.
      Returns:
      ObjectOutput to write to
      Throws:
      IOException
    • finishObjectOutput

      void finishObjectOutput(ObjectOutput oo)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finish using the given ObjectOutput. After opening a ObjectOutput and calling objectToObjectStream() multiple times, use this method to flush the data and close if necessary
      Parameters:
      oo - data output that finished using
    • objectToObjectStream

      void objectToObjectStream(Object obj, ObjectOutput out) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Marshalls an object to a given ObjectOutput
      Parameters:
      obj - object to marshall
      out - stream to marshall to
      Throws:
      IOException
    • startObjectInput

      ObjectInput startObjectInput(InputStream is, boolean isReentrant) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.

      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.

      Parameters:
      is - input stream
      isReentrant - whether the call is reentrant or not.
      Returns:
      ObjectInput to read from
      Throws:
      IOException
    • finishObjectInput

      void finishObjectInput(ObjectInput oi)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Finish using the given ObjectInput. After opening a ObjectInput and calling objectFromObjectStream() multiple times, use this method to flush the data and close if necessary
      Parameters:
      oi - data input that finished using
    • objectFromObjectStream

      Deprecated, for removal: This API element is subject to removal in a future version.
      Unmarshalls an object from an ObjectInput
      Parameters:
      in - stream to unmarshall from
      Throws:
      IOException - if unmarshalling cannot complete due to some I/O error
      ClassNotFoundException - if the class of the object trying to unmarshall is unknown
      InterruptedException - 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.
    • objectFromInputStream

      Object objectFromInputStream(InputStream is) throws IOException, ClassNotFoundException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Unmarshall an object from an InputStream
      Parameters:
      is - stream to unmarshall from
      Returns:
      the unmarshalled object instance
      Throws:
      IOException - if unmarshalling cannot complete due to some I/O error
      ClassNotFoundException - if the class of the object trying to unmarshall is unknown
    • stop

      void stop()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Stop the marshaller. Implementations of this method should clear up any cached data, or close any resources while marshalling/unmarshalling that have not been already closed.
      Specified by:
      stop in interface Marshaller
    • start

      void start()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Marshaller
      Perform any initialization required before the marshaller is used.
      Specified by:
      start in interface Marshaller