com.bigdata.btree
Class NOPTupleSerializer

java.lang.Object
  extended by com.bigdata.btree.DefaultTupleSerializer
      extended by com.bigdata.btree.NOPTupleSerializer
All Implemented Interfaces:
ITupleSerializer, IKeyBuilderFactory, Externalizable, Serializable

public class NOPTupleSerializer
extends DefaultTupleSerializer

Default implementation uses the KeyBuilder to format the object as a key and requires that the values are byte[]s which it passes on without change. Deserialization of the tuple value always the byte[] itself.

Version:
$Id: NOPTupleSerializer.java 4707 2011-06-14 15:48:36Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Field Summary
static ITupleSerializer INSTANCE
           
 
Constructor Summary
NOPTupleSerializer()
          De-serialization ctor.
NOPTupleSerializer(IKeyBuilderFactory keyBuilderFactory)
          Normally callers will use an ASCIIKeyBuilderFactory since Unicode support is not required
 
Method Summary
 Object deserialize(ITuple tuple)
          De-serializes an object from the value stored in the tuple (ignores the key stored in the tuple).
 Object deserializeKey(ITuple tuple)
          This is an unsupported operation.
 void readExternal(ObjectInput in)
           
 byte[] serializeKey(Object obj)
          Serialize a facet of an object's state that places the object into the total sort order for the index.
 byte[] serializeVal(Object obj)
          Serializes the object as a byte[] using Java default serialization.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class com.bigdata.btree.DefaultTupleSerializer
getDefaultKeyBuilderFactory, getDefaultLeafKeysCoder, getDefaultValuesCoder, getKeyBuilder, getLeafKeysCoder, getLeafValuesCoder, newInstance, setLeafKeysCoder, setLeafValuesCoder, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

public static final transient ITupleSerializer INSTANCE
Constructor Detail

NOPTupleSerializer

public NOPTupleSerializer()
De-serialization ctor.


NOPTupleSerializer

public NOPTupleSerializer(IKeyBuilderFactory keyBuilderFactory)
Normally callers will use an ASCIIKeyBuilderFactory since Unicode support is not required

Parameters:
keyBuilderFactory -
See Also:
ASCIIKeyBuilderFactory
Method Detail

serializeKey

public byte[] serializeKey(Object obj)
Serialize a facet of an object's state that places the object into the total sort order for the index. This method is automatically applied by IAutoboxBTree.insert(Object, Object) and friends to convert the key object into an unsigned variable length byte[].

Note: This handles the conversion between an object and the unsigned variable length byte[] representation of that object which determines its place within the total index order. Since this transform imposes the total order of the index, different techniques are applied here than are applied to the serialization of the index values. Return obj iff it is a byte[] and otherwise converts obj to a byte[] using IKeyBuilder.append(Object).

Specified by:
serializeKey in interface ITupleSerializer
Overrides:
serializeKey in class DefaultTupleSerializer
Parameters:
obj - A object (MAY NOT be null).
Returns:
An unsigned byte[] which places the object into the total sort order for the index and never null ( null keys are not allowed into an index).

serializeVal

public byte[] serializeVal(Object obj)
Description copied from class: DefaultTupleSerializer
Serializes the object as a byte[] using Java default serialization.

Specified by:
serializeVal in interface ITupleSerializer
Overrides:
serializeVal in class DefaultTupleSerializer
Parameters:
obj - The object to be serialized (MAY be null).
Returns:
The serialized representation of the object as a byte[] -or- null if the reference is null.

deserialize

public Object deserialize(ITuple tuple)
Description copied from class: DefaultTupleSerializer
De-serializes an object from the value stored in the tuple (ignores the key stored in the tuple).

Specified by:
deserialize in interface ITupleSerializer
Overrides:
deserialize in class DefaultTupleSerializer
Parameters:
tuple - The tuple.
Returns:
The de-serialized object.

deserializeKey

public Object deserializeKey(ITuple tuple)
This is an unsupported operation. Additional information is required to either decode the internal unsigned byte[] keys or to extract the key from the de-serialized value (if it is being stored in that value). You can either write your own ITupleSerializer or you can specialize this one so that it can de-serialize your keys using whichever approach makes the most sense for your data.

Specified by:
deserializeKey in interface ITupleSerializer
Overrides:
deserializeKey in class DefaultTupleSerializer
Throws:
UnsupportedOperationException - always.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class DefaultTupleSerializer
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class DefaultTupleSerializer
Throws:
IOException


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.