Class SerializableStream

  • All Implemented Interfaces:
    java.io.Serializable

    public class SerializableStream
    extends java.lang.Object
    implements java.io.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:
    Serialized Form
    • Field Detail

      • 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:
        Constant Field Values
      • VARIABLE_KEY_HASH_ALGORITHM

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

        public static final java.lang.String VARIABLE_KEY_HASH_VALUE
        Name of the variable used to store the hash.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SerializableStream

        public SerializableStream​(int token,
                                  java.io.InputStream input,
                                  java.lang.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,
                                  java.io.InputStream input,
                                  java.lang.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 Detail

      • 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 java.io.IOException
        Persists this SerializableStream if required.
        Returns:
        position of the element in the document's structure or -1 if nothing was persisted
        Throws:
        java.io.IOException - IO Exception when persisting
      • getVariables

        public java.util.Map<java.lang.String,​java.lang.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