org.openbandy.io.stream
Interface StreamSerializer

All Superinterfaces:
Serializer
All Known Implementing Classes:
StreamSerializerImpl

public interface StreamSerializer
extends Serializer

The StreamSerializer is an extension of the Serializer interface. It provides methods to serialize an object into a stream of (compressed) XML. Thereby, different degrees of compression are possible.

(c) Copyright P. Bolliger 2007, ALL RIGHTS RESERVED.

Version:
1.2
Author:
Philipp Bolliger (philipp@bolliger.name)

Field Summary
static int COMPRESSED_BEST
          The resulting stream will be compressed by replacing common values and attributes with tokens and additionaly compressed using zip.
static int COMPRESSED_TOKEN
          The resulting stream will be compressed by replacing common values and attributes with tokens.
static int COMPRESSED_ZIP
          The resulting stream will ge compressed using zip compression.
static int COMPRESSION_NONE
          The resulting stream will not be compressed.
 
Fields inherited from interface org.openbandy.io.Serializer
MODE_DATABASE, MODE_DEFAULT, MODE_RMS, MODE_STREAM
 
Method Summary
 Serializable createContentObject(StreamSerializationBuffer streamSerializationBuffer)
          This method creates a new serializable object according to the class name that can be read next from the inputstream in the streamSerializationBuffer.
 Serializable getObjectFromXmlStream(java.io.ByteArrayInputStream inputStream)
          This method deserializes an object from the given InputStream.
 java.io.ByteArrayOutputStream getXmlStream(Serializable serializable, int compression)
          This method generates an XML representation of the given object.
 
Methods inherited from interface org.openbandy.io.Serializer
deserializeObject, serializeObject
 

Field Detail

COMPRESSION_NONE

static final int COMPRESSION_NONE
The resulting stream will not be compressed.

See Also:
Constant Field Values

COMPRESSED_TOKEN

static final int COMPRESSED_TOKEN
The resulting stream will be compressed by replacing common values and attributes with tokens.

See Also:
Constant Field Values

COMPRESSED_ZIP

static final int COMPRESSED_ZIP
The resulting stream will ge compressed using zip compression.

See Also:
Constant Field Values

COMPRESSED_BEST

static final int COMPRESSED_BEST
The resulting stream will be compressed by replacing common values and attributes with tokens and additionaly compressed using zip.

See Also:
Constant Field Values
Method Detail

getXmlStream

java.io.ByteArrayOutputStream getXmlStream(Serializable serializable,
                                           int compression)
This method generates an XML representation of the given object. If desired, the resulting stream may be compressed.

Parameters:
serializable - The object that needs to be serialized.
compression - The degree of compression desired.
Returns:
An OutputStream of serialized XML.

getObjectFromXmlStream

Serializable getObjectFromXmlStream(java.io.ByteArrayInputStream inputStream)
This method deserializes an object from the given InputStream. In doing so, the degree of compression is resolved by this method.

Parameters:
inputStream - The InputStream to read from.
Returns:
The object that resulted from deserialization. In case of failure, it will return NULL.

createContentObject

Serializable createContentObject(StreamSerializationBuffer streamSerializationBuffer)
This method creates a new serializable object according to the class name that can be read next from the inputstream in the streamSerializationBuffer.

Parameters:
content - Reference to the content object.
streamSerializationBuffer - Proxy containing the inputstream.