public class DefaultNodeCoder extends Object implements IAbstractNodeDataCoder<INodeData>, Externalizable
INodeData
records.Constructor and Description |
---|
DefaultNodeCoder()
De-serialization ctor.
|
DefaultNodeCoder(IRabaCoder keysCoder) |
Modifier and Type | Method and Description |
---|---|
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) |
public DefaultNodeCoder()
public DefaultNodeCoder(IRabaCoder keysCoder)
keysCoder
- The IRabaCoder
for the node's keys.public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public final boolean isLeafDataCoder()
isLeafDataCoder
in interface IAbstractNodeDataCoder<INodeData>
ILeafData
public boolean isNodeDataCoder()
isNodeDataCoder
in interface IAbstractNodeDataCoder<INodeData>
INodeData
public INodeData decode(AbstractFixedByteArrayBuffer data)
IAbstractNodeDataCoder
IAbstractNodeData
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.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.