net.named_data.jndn.encoding
public class BinaryXmlEncoder extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ENCODING_LIMIT_1_BYTE |
static int |
ENCODING_LIMIT_2_BYTES |
static int |
ENCODING_LIMIT_3_BYTES |
| Constructor and Description |
|---|
BinaryXmlEncoder()
Create a new BinaryXmlEncoder with a default DynamicByteBuffer for the output buffer.
|
BinaryXmlEncoder(int initialCapacity)
Create a new BinaryXmlEncoder to use a DynamicByteBuffer with the initialCapacity.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getOffset()
Get the current offset where the next data will be written in the output buffer.
|
ByteBuffer |
getOutput()
Return a slice of the output buffer up to the current position.
|
void |
writeAbsDoubleBigEndianBlob(double value) |
void |
writeBlob(Blob value)
Write a BLOB header, then the bytes of the blob value to the output buffer.
|
void |
writeBlobDTagElement(int tag,
Blob value)
Write an element start header using DTAG with the tag to the output buffer, then the blob, then an element close.
|
void |
writeElementClose()
Write an element close to the output buffer.
|
void |
writeElementStartDTag(int tag)
Write an element start header using DTAG with the tag to the output buffer.
|
void |
writeOptionalBlobDTagElement(int tag,
Blob value)
If value.buf() is null or value.size() is 0 then do nothing, otherwise call writeBlobDTagElement.
|
void |
writeOptionalTimeMillisecondsDTagElement(int tag,
double milliseconds)
If milliseconds is negative then do nothing, otherwise call writeTimeMillisecondsDTagElement.
|
void |
writeOptionalUDataDTagElement(int tag,
Blob value)
If value.buf() is null or value.size() is 0 then do nothing, otherwise call writeUDataDTagElement.
|
void |
writeOptionalUnsignedDecimalIntDTagElement(int tag,
int value)
If value is negative then do nothing, otherwise call writeUnsignedDecimalIntDTagElement.
|
void |
writeTimeMillisecondsDTagElement(int tag,
double milliseconds)
Write an element start header using DTAG with the tag to the output buffer, then the absolute value of milliseconds
as a big endian BLOB converted to 4096 ticks per second, then an element close.
|
void |
writeUData(Blob value)
Write a UDATA header, then the bytes of the UDATA value to the output buffer.
|
void |
writeUDataDTagElement(int tag,
Blob value)
Write an element start header using DTAG with the tag to the output buffer, then the UDATA value, then an element close.
|
void |
writeUnsignedDecimalInt(int value)
Write a UDATA header, then the value as an unsigned decimal integer.
|
void |
writeUnsignedDecimalIntDTagElement(int tag,
int value)
Write an element start header using DTAG with the tag to the output buffer, then the value as an unsigned decimal integer,
then an element close.
|
public static final int ENCODING_LIMIT_1_BYTE
public static final int ENCODING_LIMIT_2_BYTES
public static final int ENCODING_LIMIT_3_BYTES
public BinaryXmlEncoder(int initialCapacity)
initialCapacity - The initial capacity of buffer().public BinaryXmlEncoder()
public final int getOffset()
public final ByteBuffer getOutput()
public final void writeElementStartDTag(int tag)
tag - The DTAG tag.public final void writeElementClose()
public final void writeBlob(Blob value)
value - A Blob with the buffer for the value.public final void writeBlobDTagElement(int tag,
Blob value)
tag - The DTAG tag.value - A Blob with the buffer for the value.public final void writeOptionalBlobDTagElement(int tag,
Blob value)
tag - The DTAG tag.value - A Blob with the buffer for the value.public final void writeUData(Blob value)
value - A Blob with the buffer for the value.public final void writeUDataDTagElement(int tag,
Blob value)
tag - The DTAG tag.value - A Blob with the buffer for the value.public final void writeOptionalUDataDTagElement(int tag,
Blob value)
tag - The DTAG tag.value - A Blob with the buffer for the value.public final void writeUnsignedDecimalInt(int value)
value - The unsigned integer.public final void writeUnsignedDecimalIntDTagElement(int tag,
int value)
tag - The DTAG tag.value - The unsigned integer.public final void writeOptionalUnsignedDecimalIntDTagElement(int tag,
int value)
tag - The DTAG tag.value - The unsigned integer.public final void writeAbsDoubleBigEndianBlob(double value)
public final void writeTimeMillisecondsDTagElement(int tag,
double milliseconds)
tag - The DTAG tag.milliseconds - The the number of milliseconds.public final void writeOptionalTimeMillisecondsDTagElement(int tag,
double milliseconds)
tag - The DTAG tag.milliseconds - The the number of milliseconds.Copyright © 2015. All rights reserved.