net.named_data.jndn.encoding.der
public class DerNode extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DerNode.DerBitString
A DerBitString extends DerNode to handle a bit string.
|
static class |
DerNode.DerBoolean
DerBoolean extends DerNode to encode a boolean value.
|
static class |
DerNode.DerByteString
A DerByteString extends DerNode to handle byte strings.
|
static class |
DerNode.DerGeneralizedTime
A DerGeneralizedTime extends DerNode to represent a date and time, with
millisecond accuracy.
|
static class |
DerNode.DerInteger
DerInteger extends DerNode to encode an integer value.
|
static class |
DerNode.DerNull
A DerNull extends DerNode to encode a null value.
|
static class |
DerNode.DerOctetString
DerOctetString extends DerByteString to encode a string of bytes.
|
static class |
DerNode.DerOid
A DerOid extends DerNode to represent an object identifier
|
static class |
DerNode.DerPrintableString
A DerPrintableString extends DerByteString to handle a a printable string.
|
static class |
DerNode.DerSequence
A DerSequence extends DerStructure to contains an ordered sequence of other
nodes.
|
static class |
DerNode.DerStructure
A DerStructure extends DerNode to hold other DerNodes.
|
Modifier and Type | Field and Description |
---|---|
protected ByteBuffer |
header_ |
protected DerNode.DerStructure |
parent_ |
protected DynamicByteBuffer |
payload_ |
Modifier and Type | Method and Description |
---|---|
protected void |
decode(ByteBuffer inputBuf,
int startIdx)
Decode and store the data from an input buffer.
|
protected int |
decodeHeader(ByteBuffer inputBuf,
int startIdx)
Extract the header from an input buffer and return the size.
|
Blob |
encode()
Get the raw data encoding for this node.
|
protected void |
encodeHeader(int size)
Encode the given size and update the header.
|
List |
getChildren()
If this object is a DerSequence, get the children of this node.
|
Blob |
getPayload()
Get a copy of the payload bytes.
|
static DerNode.DerSequence |
getSequence(List children,
int index)
Check that index is in bounds for the children list, cast
children.get(index) to DerSequence and return it.
|
int |
getSize() |
static DerNode |
parse(ByteBuffer inputBuf)
Parse the data from the input buffer recursively and return the root as an
object of a subclass of DerNode.
|
static DerNode |
parse(ByteBuffer inputBuf,
int startIdx)
Parse the data from the input buffer recursively and return the root as an
object of a subclass of DerNode.
|
Object |
toVal()
Convert the encoded data to a standard representation.
|
protected DerNode.DerStructure parent_
protected ByteBuffer header_
protected DynamicByteBuffer payload_
public int getSize()
protected final void encodeHeader(int size)
size
- The payload size to encode.protected final int decodeHeader(ByteBuffer inputBuf, int startIdx)
inputBuf
- The input buffer to read from. This reads from
startIdx (regardless of the buffer's position) and does not change the
position.startIdx
- The offset into the buffer.public Blob encode()
protected void decode(ByteBuffer inputBuf, int startIdx) throws DerDecodingException
inputBuf
- The input buffer to read from. This reads from
startIdx (regardless of the buffer's position) and does not change the
position.startIdx
- The offset into the buffer.DerDecodingException
public static DerNode parse(ByteBuffer inputBuf, int startIdx) throws DerDecodingException
inputBuf
- The input buffer to read from. This reads from
startIdx (regardless of the buffer's position) and does not change the
position.startIdx
- The offset into the buffer.DerDecodingException
public static DerNode parse(ByteBuffer inputBuf) throws DerDecodingException
inputBuf
- The input buffer to read from. This reads from
position and does not change the position.DerDecodingException
public Object toVal() throws DerDecodingException
DerDecodingException
public final Blob getPayload()
public List getChildren() throws DerDecodingException
DerDecodingException
- if this object is not a DerSequence.public static DerNode.DerSequence getSequence(List children, int index) throws DerDecodingException
children
- The list of DerNode, usually returned by another
call to getChildren.index
- The index of the children.DerDecodingException
- if index is out of bounds or if
children.get(index) is not a DerSequence.Copyright © 2016. All rights reserved.