com.tc.object.dna.api
Interface DNAEncoding


public interface DNAEncoding

Defines how to encode DNA onto a stream or decode data from a stream, with some different policies for encoding.


Field Summary
static byte APPLICATOR
          When the policy is set to APPLICATOR then the DNAEncoding.decode() will return the original Objects that were encoded in the original stream.
static byte SERIALIZER
          When the policy is set to SERIALIZER then the DNAEncoding.decode() will return the exact Objects that where encoded.
static byte STORAGE
          When the policy is set to STORAGE then the DNAEncoding.decode() may return Objects that represent the original objects for performance/memory.
 
Method Summary
 java.lang.Object decode(TCDataInput input)
          Decode an object from an input stream
 void encode(java.lang.Object value, TCDataOutput output)
          Encode an object onto an output stream
 void encodeArray(java.lang.Object value, TCDataOutput output)
          Encode an array onto an output stream, automatically determine array length
 void encodeArray(java.lang.Object value, TCDataOutput output, int length)
          Encode an array onto an output stream
 void encodeClassLoader(java.lang.ClassLoader value, TCDataOutput output)
          Encode a classloader object onto an output stream
 

Field Detail

SERIALIZER

static final byte SERIALIZER
When the policy is set to SERIALIZER then the DNAEncoding.decode() will return the exact Objects that where encoded. For Example if UTF8ByteDataHolder is serialized to a stream, then when it is deserialized, you get an UTF8ByteDataHolder object. Same goes for String or ClassHolder etc.

You may want such a policy in TCObjectInputStream, for example.

See Also:
Constant Field Values

STORAGE

static final byte STORAGE
When the policy is set to STORAGE then the DNAEncoding.decode() may return Objects that represent the original objects for performance/memory. For Example if String is serialized to a stream, then when it is deserialized, you may get UTF8ByteDataHolder instead.

As the name says, you may want such a policy for storage in the L2.

See Also:
Constant Field Values

APPLICATOR

static final byte APPLICATOR
When the policy is set to APPLICATOR then the DNAEncoding.decode() will return the original Objects that were encoded in the original stream. For Example if UTF8ByteDataHolder is serialized to a stream, then when it is deserialized, you get a String object.

You may want such a policy in TCObjectInputStream, for example.

See Also:
Constant Field Values
Method Detail

encodeClassLoader

void encodeClassLoader(java.lang.ClassLoader value,
                       TCDataOutput output)
Encode a classloader object onto an output stream

Parameters:
value - The classloader
output - The output

encode

void encode(java.lang.Object value,
            TCDataOutput output)
Encode an object onto an output stream

Parameters:
value - The object
output - The output

decode

java.lang.Object decode(TCDataInput input)
                        throws java.io.IOException,
                               java.lang.ClassNotFoundException
Decode an object from an input stream

Parameters:
input - The input stream
Throws:
java.io.IOException
java.lang.ClassNotFoundException

encodeArray

void encodeArray(java.lang.Object value,
                 TCDataOutput output)
Encode an array onto an output stream, automatically determine array length

Parameters:
value - The array
output - The output

encodeArray

void encodeArray(java.lang.Object value,
                 TCDataOutput output,
                 int length)
Encode an array onto an output stream

Parameters:
value - The array
output - The output
length - The length of the array to encode


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.