Package com.saperion.rmi
Class SerializableStream
- java.lang.Object
-
- com.saperion.rmi.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 Summary
Fields Modifier and Type Field Description static int
BUFFER_SIZE
Default buffer-size used for writing.static byte[]
EMPTY
An empty byte-array.static java.lang.String
VARIABLE_KEY_HASH_ALGORITHM
Name of the variable used to store the hash algorithm.static java.lang.String
VARIABLE_KEY_HASH_VALUE
Name of the variable used to store the hash.
-
Constructor Summary
Constructors Constructor Description SerializableStream(int token, ContentStream content, int bufferSize)
ContentStream constructor.SerializableStream(int token, ContentStream content, int bufferSize, SerializableStreamContentHandler.ContentHandlers contentHandler)
ContentStream constructor.SerializableStream(int token, java.io.InputStream input, java.lang.String filename, int element, int bufferSize, boolean doStreaming)
Instantiates a new serializable stream.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getActualCount()
Gets the actual count.int
getPosition()
java.util.Map<java.lang.String,java.lang.String>
getVariables()
Returns the variables belonging to the content element written by this stream.boolean
isClearContent()
long
persist()
Persists this SerializableStream if required.void
validate()
Validates the stream.
-
-
-
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 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, 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 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
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 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 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 noInputStream
.
-
getPosition
public int getPosition()
- Returns:
- position of element in structure
-
-