Package com.saperion.rmi
Class SerializableStream
java.lang.Object
com.saperion.rmi.SerializableStream
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSerializableStream
(int token, ContentStream content, int bufferSize) ContentStream constructor.SerializableStream
(int token, ContentStream content, int bufferSize, SerializableStreamContentHandler.ContentHandlers contentHandler) ContentStream constructor.SerializableStream
(int token, InputStream input, String filename, int element, int bufferSize, boolean doStreaming) Instantiates a new serializable stream.SerializableStream
(int token, InputStream input, String filename, int element, int bufferSize, boolean doStreaming, SerializableStreamContentHandler.ContentHandlers contentHandler) Instantiates a new serializable stream. -
Method Summary
-
Field Details
-
EMPTY
public static final byte[] EMPTYAn empty byte-array. -
BUFFER_SIZE
public static final int BUFFER_SIZEDefault buffer-size used for writing.- See Also:
-
VARIABLE_KEY_HASH_ALGORITHM
Name of the variable used to store the hash algorithm.- See Also:
-
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 tokeninput
- the inputfilename
- the filenameelement
- the elementbufferSize
- size of buffer chunkdoStreaming
- 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 tokeninput
- the inputfilename
- the filenameelement
- the elementbufferSize
- size of buffer chunkdoStreaming
- True if streaming option of content data is activated.contentHandler
- handles the writing of the content when serializing this stream
-
SerializableStream
ContentStream constructor. Supports the content-hash and content-length validation of the given ContentStream.- Parameters:
token
- user tokencontent
- content stream to wrapbufferSize
- 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 tokencontent
- content stream to wrapbufferSize
- size of buffer chunkcontentHandler
- 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
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
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
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 noInputStream
.
-
getPosition
public int getPosition()- Returns:
- position of element in structure
-