com.bigdata.btree.data
Interface IAbstractNodeDataCoder<T extends IAbstractNodeData>

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultDirectoryPageCoder, DefaultLeafCoder, DefaultNodeCoder

public interface IAbstractNodeDataCoder<T extends IAbstractNodeData>
extends Serializable

Interface for coding (compressing) an INodeData or ILeafData onto a byte[].

Version:
$Id: IAbstractNodeDataCoder.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Method Summary
 T decode(AbstractFixedByteArrayBuffer data)
          Return an IAbstractNodeData instance which can access the coded data.
 AbstractFixedByteArrayBuffer encode(T node, DataOutputBuffer buf)
          Encode the data, returning a slice containing the coded data.
 T encodeLive(T node, DataOutputBuffer buf)
          Encode the data, returning a reference to a coded instance of the data.
 boolean isLeafDataCoder()
          Return true if this implementation can code data records for B+Tree leaves.
 boolean isNodeDataCoder()
          Return true if this implementation can code data records for B+Tree nodes.
 

Method Detail

isNodeDataCoder

boolean isNodeDataCoder()
Return true if this implementation can code data records for B+Tree nodes.

See Also:
INodeData

isLeafDataCoder

boolean isLeafDataCoder()
Return true if this implementation can code data records for B+Tree leaves.

See Also:
ILeafData

encode

AbstractFixedByteArrayBuffer encode(T node,
                                    DataOutputBuffer buf)
Encode the data, returning a slice containing the coded data.

Note: Implementations of this method are typically heavy. While it is always valid to encode(IAbstractNodeData, DataOutputBuffer) an IAbstractNodeData, DO NOT invoke this arbitrarily on data which may already be coded. The IAbstractNodeCodedData interface will always be implemented for coded data.

Parameters:
node - The node or leaf data.
buf - A buffer on which the coded data will be written.
Returns:
A slice onto the post-condition state of the caller's buffer whose view corresponds to the coded record. This may be written directly onto an output stream or the slice may be converted to an exact fit byte[].
Throws:
UnsupportedOperationException - if IAbstractNodeData.isLeaf() is true and this IAbstractNodeDataCoder can not code B+Tree ILeafData records.
UnsupportedOperationException - if IAbstractNodeData.isLeaf() is false and this IAbstractNodeDataCoder can not code B+Tree INodeData records.

encodeLive

T encodeLive(T node,
             DataOutputBuffer buf)
Encode the data, returning a reference to a coded instance of the data.

Note: Implementations of this method are typically heavy. While it is always valid to encode(IAbstractNodeData, DataOutputBuffer) an IAbstractNodeData, DO NOT invoke this arbitrarily on data which may already be coded. The IAbstractNodeCodedData interface will always be implemented for coded data.

Parameters:
node - The node or leaf data.
buf - A buffer on which the coded data will be written.
Returns:
A reference to a coded instance of the data. IAbstractNodeData.data() is a slice onto the post-condition state of the caller's buffer whose view corresponds to the coded record. This may be written directly onto an output stream or the slice may be converted to an exact fit byte[].
Throws:
UnsupportedOperationException - if IAbstractNodeData.isLeaf() is true and this IAbstractNodeDataCoder can not code B+Tree ILeafData records.
UnsupportedOperationException - if IAbstractNodeData.isLeaf() is false and this IAbstractNodeDataCoder can not code B+Tree INodeData records.

decode

T decode(AbstractFixedByteArrayBuffer data)
Return an IAbstractNodeData instance which can access the coded data.

Parameters:
data - The record containing the coded data.
Returns:
A view of the coded data.


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