|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.btree.data.DefaultNodeCoder
public class DefaultNodeCoder
Default implementation for immutable INodeData records.
INodeData are feasible. The
only reason to expand an INodeData into a fully
MutableNodeData is if we need to modify the keys. The rest of
the fields could be easily patched in place if they were not coded
(they are fixed length fields). Of course, we have a more compact
representation when those fields ARE coded.| Constructor Summary | |
|---|---|
DefaultNodeCoder()
De-serialization ctor. |
|
DefaultNodeCoder(IRabaCoder keysCoder)
|
|
| Method Summary | |
|---|---|
INodeData |
decode(AbstractFixedByteArrayBuffer data)
Return an IAbstractNodeData instance which can access the coded
data. |
AbstractFixedByteArrayBuffer |
encode(INodeData node,
DataOutputBuffer buf)
Encode the data, returning a slice containing the coded data. |
INodeData |
encodeLive(INodeData node,
DataOutputBuffer buf)
Encode the data, returning a reference to a coded instance of the data. |
boolean |
isLeafDataCoder()
No. |
boolean |
isNodeDataCoder()
Yes. |
void |
readExternal(ObjectInput in)
|
String |
toString()
|
static StringBuilder |
toString(INodeData node,
StringBuilder sb)
Utility method formats the INodeData. |
void |
writeExternal(ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultNodeCoder()
public DefaultNodeCoder(IRabaCoder keysCoder)
keysCoder - The IRabaCoder for the node's keys.| Method Detail |
|---|
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOExceptionpublic final boolean isLeafDataCoder()
isLeafDataCoder in interface IAbstractNodeDataCoder<INodeData>ILeafDatapublic boolean isNodeDataCoder()
isNodeDataCoder in interface IAbstractNodeDataCoder<INodeData>INodeDatapublic String toString()
toString in class Objectpublic INodeData decode(AbstractFixedByteArrayBuffer data)
IAbstractNodeDataCoderIAbstractNodeData instance which can access the coded
data.
decode in interface IAbstractNodeDataCoder<INodeData>data - The record containing the coded data.
public INodeData encodeLive(INodeData node,
DataOutputBuffer buf)
IAbstractNodeDataCoder
Note: Implementations of this method are typically heavy. While it is
always valid to IAbstractNodeDataCoder.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.
encodeLive in interface IAbstractNodeDataCoder<INodeData>node - The node or leaf data.buf - A buffer on which the coded data will be written.
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[].
public AbstractFixedByteArrayBuffer encode(INodeData node,
DataOutputBuffer buf)
IAbstractNodeDataCoder
Note: Implementations of this method are typically heavy. While it is
always valid to IAbstractNodeDataCoder.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.
encode in interface IAbstractNodeDataCoder<INodeData>node - The node or leaf data.buf - A buffer on which the coded data will be written.
public static StringBuilder toString(INodeData node,
StringBuilder sb)
INodeData.
node - A node data record.sb - The representation will be written onto this object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||