net.named_data.jndn.encoding
public class BinaryXmlDecoder extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
BinaryXmlDecoder.TypeAndValue |
| Constructor and Description |
|---|
BinaryXmlDecoder(ByteBuffer input)
Create a new BinaryXmlDecoder to decode the input.
|
| Modifier and Type | Method and Description |
|---|---|
BinaryXmlDecoder.TypeAndValue |
decodeTypeAndValue()
Decode the header's type and value from the input starting at its position.
|
int |
getOffset()
Get the current position of the input, used for the next read.
|
boolean |
peekDTag(int expectedTag)
Decode the header from the input starting at its position, and if it is a DTAG where the value is the expectedTag,
then set return true.
|
ByteBuffer |
readBinaryDTagElement(int expectedTag)
Decode the header from the input starting its position, expecting the type to be DTAG and the value to be expectedTag.
|
ByteBuffer |
readBinaryDTagElement(int expectedTag,
boolean allowNull)
Decode the header from the input starting its position, expecting the type to be DTAG and the value to be expectedTag.
|
void |
readElementClose()
Read one byte from the input starting at its position, expecting it to be the element close.
|
void |
readElementStartDTag(int expectedTag)
Decode the header from the input starting at its position, expecting the type to be DTAG and the value to be expectedTag.
|
ByteBuffer |
readOptionalBinaryDTagElement(int expectedTag)
Peek at the next element and if it is the expectedTag, call readBinaryDTagElement.
|
ByteBuffer |
readOptionalBinaryDTagElement(int expectedTag,
boolean allowNull)
Peek at the next element and if it is the expectedTag, call readBinaryDTagElement.
|
double |
readOptionalTimeMillisecondsDTagElement(int expectedTag)
Peek at the next element, and if it has the expectedTag then call
readTimeMillisecondsDTagElement.
|
ByteBuffer |
readOptionalUDataDTagElement(int expectedTag)
Peek at the next element and if it is the expectedTag, call readUDataDTagElement.
|
int |
readOptionalUnsignedIntegerDTagElement(int expectedTag)
Peek at the next element, and if it has the expectedTag then call readUnsignedIntegerDTagElement.
|
double |
readTimeMillisecondsDTagElement(int expectedTag)
Decode the header from the input starting at its position, expecting the type to be
DTAG and the value to be expectedTag.
|
ByteBuffer |
readUDataDTagElement(int expectedTag)
Decode the header from the input starting at its position, expecting the type to be
DTAG and the value to be expectedTag.
|
int |
readUnsignedIntegerDTagElement(int expectedTag)
Decode the header from the input starting at its position, expecting the type to be
DTAG and the value to be expectedTag.
|
void |
seek(int position)
Set the position of the input, used for the next read.
|
double |
unsignedBigEndianToDouble(ByteBuffer bytes)
Interpret the bytes as an unsigned big endian integer and convert to a double.
|
public BinaryXmlDecoder(ByteBuffer input)
input - The input ByteBuffer whose position and limit are set to the desired bytes to decode.
This calls input.duplicate(), but does not copy the underlying buffer whose contents must remain valid during
the life of this object.public BinaryXmlDecoder.TypeAndValue decodeTypeAndValue() throws EncodingException
EncodingException - For invalid encoding including if the first head octet is zero.public final void readElementStartDTag(int expectedTag)
throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding including if did not get the expected DTAG.public final void readElementClose()
throws EncodingException
EncodingException - For invalid encoding including if did not get the expected element close.public final boolean peekDTag(int expectedTag)
throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding including if did not get the expected DTAG.public final ByteBuffer readBinaryDTagElement(int expectedTag, boolean allowNull) throws EncodingException
expectedTag - The expected value for DTAG.allowNull - True if the binary item may be missing.EncodingException - For invalid encoding including if did not get the expected DTAG.public final ByteBuffer readBinaryDTagElement(int expectedTag) throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding including if did not get the expected DTAG.public final ByteBuffer readOptionalBinaryDTagElement(int expectedTag, boolean allowNull) throws EncodingException
expectedTag - The expected value for DTAG.allowNull - True if the binary item may be missing.EncodingException - For invalid encoding.public final ByteBuffer readOptionalBinaryDTagElement(int expectedTag) throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding.public final ByteBuffer readUDataDTagElement(int expectedTag) throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding including if did not get the expected DTAG.public final ByteBuffer readOptionalUDataDTagElement(int expectedTag) throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding.public final int readUnsignedIntegerDTagElement(int expectedTag)
throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding including if did not get the expected
DTAG or can't parse the decimal integer.public final int readOptionalUnsignedIntegerDTagElement(int expectedTag)
throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding including if can't parse the
decimal integer.public final double readTimeMillisecondsDTagElement(int expectedTag)
throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding including if did not get the expected DTAG.public final double readOptionalTimeMillisecondsDTagElement(int expectedTag)
throws EncodingException
expectedTag - The expected value for DTAG.EncodingException - For invalid encoding.public final double unsignedBigEndianToDouble(ByteBuffer bytes)
bytes - The ByteBuffer with the value. This reads from position() to limit().public final int getOffset()
public final void seek(int position)
position - The new position.Copyright © 2015. All rights reserved.