public static class Attribute.AttributeWithOneValue
extends java.lang.Object
----------------------------------------------- | value-tag | 1 byte ----------------------------------------------- | name-length (value is u) | 2 bytes ----------------------------------------------- | name | u bytes ----------------------------------------------- | value-length (value is v) | 2 bytes ----------------------------------------------- | value | v bytes -----------------------------------------------
The "value-tag" field specifies the attribute syntax, e.g. 0x44 for the attribute syntax 'keyword'.
The "name-length" field specifies the length of the "name" field in bytes, e.g. u in the above diagram or 15 for the name "sides- supported".
The "name" field contains the textual name of the attribute, e.g. "sides-supported".
The "value-length" field specifies the length of the "value" field in bytes, e.g. v in the above diagram or 9 for the (keyword) value 'one-sided'.
The "value" field contains the value of the attribute, e.g. the textual value 'one-sided'.
| Constructor and Description |
|---|
AttributeWithOneValue(java.nio.ByteBuffer bytes)
Instantiates a new attribute-with-one-value from the given bytes.
|
AttributeWithOneValue(ValueTags valueTag,
java.lang.String name,
byte[] value)
Instantiates a new attribute-with-one-value.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getName()
The "name" field contains the textual name of the attribute.
|
java.lang.String |
getStringValue()
The "value" field contains the value of the attribute.
|
byte[] |
getValue()
The "value" field contains the value of the attribute.
|
ValueTags |
getValueTag()
The "value-tag" field specifies the attribute syntax, e.g. 0x44
for the attribute syntax 'keyword'.
|
void |
setValue(byte[] value)
Sets the value of the attribute.
|
byte[] |
toByteArray()
Converts an attribute-with-one-value to a byte array.
|
public AttributeWithOneValue(java.nio.ByteBuffer bytes)
ByteBuffer must be positioned at the beginning of the
attribute-group.bytes - ByteBuffer positioned at the beginningpublic AttributeWithOneValue(ValueTags valueTag, java.lang.String name, byte[] value)
valueTag - the value-tagname - name of the attributevalue - binary value of the attributepublic ValueTags getValueTag()
ValueTags.KEYWORDpublic java.lang.String getName()
public void setValue(byte[] value)
value - as byte arraypublic byte[] getValue()
public java.lang.String getStringValue()
public byte[] toByteArray()
----------------------------------------------- | value-tag | 1 byte ----------------------------------------------- | name-length (value is u) | 2 bytes ----------------------------------------------- | name | u bytes ----------------------------------------------- | value-length (value is v) | 2 bytes ----------------------------------------------- | value | v bytes -----------------------------------------------
Copyright © 2018–2020. All rights reserved.