public class DefaultLeafCoder extends Object implements IAbstractNodeDataCoder<ILeafData>, Externalizable
ILeafData
records.Constructor and Description |
---|
DefaultLeafCoder()
De-serialization ctor.
|
DefaultLeafCoder(IRabaCoder keysCoder,
IRabaCoder valsCoder) |
Modifier and Type | Method and Description |
---|---|
ILeafData |
decode(AbstractFixedByteArrayBuffer data)
Return an
IAbstractNodeData instance which can access the coded
data. |
AbstractFixedByteArrayBuffer |
encode(ILeafData leaf,
DataOutputBuffer buf)
Encode the data, returning a slice containing the coded data.
|
ILeafData |
encodeLive(ILeafData leaf,
DataOutputBuffer buf)
Encode the data, returning a reference to a coded instance of the data.
|
boolean |
isLeafDataCoder()
Yes.
|
boolean |
isNodeDataCoder()
No.
|
void |
readExternal(ObjectInput in) |
String |
toString() |
static StringBuilder |
toString(ILeafData leaf,
StringBuilder sb)
Utility method formats the
ILeafData . |
void |
writeExternal(ObjectOutput out) |
public DefaultLeafCoder()
public DefaultLeafCoder(IRabaCoder keysCoder, IRabaCoder valsCoder)
keysCoder
- The IRabaCoder
for the leaf's keys.valsCoder
- The IRabaCoder
for the leaf's values.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<ILeafData>
ILeafData
public boolean isNodeDataCoder()
isNodeDataCoder
in interface IAbstractNodeDataCoder<ILeafData>
INodeData
public ILeafData decode(AbstractFixedByteArrayBuffer data)
IAbstractNodeDataCoder
IAbstractNodeData
instance which can access the coded
data.decode
in interface IAbstractNodeDataCoder<ILeafData>
data
- The record containing the coded data.public ILeafData encodeLive(ILeafData leaf, 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<ILeafData>
leaf
- 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(ILeafData leaf, 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<ILeafData>
leaf
- The node or leaf data.buf
- A buffer on which the coded data will be written.public static StringBuilder toString(ILeafData leaf, StringBuilder sb)
ILeafData
.leaf
- A leaf data record.sb
- The representation will be written onto this object.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.