Class SerializableStream

java.lang.Object
com.saperion.rmi.SerializableStream
All Implemented Interfaces:
Serializable

public class SerializableStream extends Object implements Serializable
When this stream is serialized, it's content will be written to the archive or to a temporary buffer on the server side.
See Also:
  • Field Details

    • EMPTY

      public static final byte[] EMPTY
      An empty byte-array.
    • BUFFER_SIZE

      public static final int BUFFER_SIZE
      Default buffer-size used for writing.
      See Also:
    • VARIABLE_KEY_HASH_ALGORITHM

      public static final String VARIABLE_KEY_HASH_ALGORITHM
      Name of the variable used to store the hash algorithm.
      See Also:
    • VARIABLE_KEY_HASH_VALUE

      public static final String VARIABLE_KEY_HASH_VALUE
      Name of the variable used to store the hash.
      See Also:
  • Constructor Details

    • SerializableStream

      public SerializableStream(int token, InputStream input, String filename, int element, int bufferSize, boolean doStreaming)
      Instantiates a new serializable stream.
      Parameters:
      token - the token
      input - the input
      filename - the filename
      element - the element
      bufferSize - size of buffer chunk
      doStreaming - True if streaming option of content data is activated.
    • SerializableStream

      public SerializableStream(int token, InputStream input, String filename, int element, int bufferSize, boolean doStreaming, SerializableStreamContentHandler.ContentHandlers contentHandler)
      Instantiates a new serializable stream.
      Parameters:
      token - the token
      input - the input
      filename - the filename
      element - the element
      bufferSize - size of buffer chunk
      doStreaming - True if streaming option of content data is activated.
      contentHandler - handles the writing of the content when serializing this stream
    • SerializableStream

      public SerializableStream(int token, ContentStream content, int bufferSize)
      ContentStream constructor. Supports the content-hash and content-length validation of the given ContentStream.
      Parameters:
      token - user token
      content - content stream to wrap
      bufferSize - size of buffer chunk
    • SerializableStream

      public SerializableStream(int token, ContentStream content, int bufferSize, SerializableStreamContentHandler.ContentHandlers contentHandler)
      ContentStream constructor. Supports the content-hash and content-length validation of the given ContentStream.
      Parameters:
      token - user token
      content - content stream to wrap
      bufferSize - size of buffer chunk
      contentHandler - handles the writing of the content when serializing this stream
  • Method Details

    • getActualCount

      public long getActualCount()
      Gets the actual count.
      Returns:
      the actual count
    • validate

      public void validate() throws StreamVerificationException
      Validates the stream. Validation takes place after the stream was read, so call this method after this stream was serialized to the RMI server.
      Throws:
      StreamVerificationException - if the expected hash or length was not matched.
    • persist

      public long persist() throws IOException
      Persists this SerializableStream if required.
      Returns:
      position of the element in the document's structure or -1 if nothing was persisted
      Throws:
      IOException - IO Exception when persisting
    • getVariables

      public Map<String,String> getVariables()
      Returns the variables belonging to the content element written by this stream.
      Returns:
      variables map or null if no variables were set
    • isClearContent

      public boolean isClearContent()
      Returns:
      True if the included ContentStream has no InputStream.
    • getPosition

      public int getPosition()
      Returns:
      position of element in structure