|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.directory.shared.asn1.ber.tlv.Value
public class Value
This class stores the data decoded from a TLV.
| Field Summary | |
|---|---|
static byte |
FALSE_VALUE
The encoded byte for a FALSE value |
static byte |
TRUE_VALUE
The encoded byte for a TRUE value |
| Constructor Summary | |
|---|---|
Value()
The constructor. |
|
Value(byte[] value)
The constructor. |
|
| Method Summary | |
|---|---|
void |
addData(byte[] array)
Append some bytes to the data buffer. |
void |
addData(ByteBuffer buffer)
Append some bytes to the data buffer. |
static void |
encode(ByteBuffer buffer,
BitString bitString)
Encode a BIT STRING value |
static void |
encode(ByteBuffer buffer,
boolean bool)
Encode a boolean value |
static void |
encode(ByteBuffer buffer,
byte[] bytes)
Encode an OctetString value |
static void |
encode(ByteBuffer buffer,
byte tag,
int value)
Encode an integer value |
static void |
encode(ByteBuffer buffer,
int value)
Encode an integer value |
static void |
encode(ByteBuffer buffer,
long value)
Encode a long value |
static void |
encode(ByteBuffer buffer,
OID oid)
Encode an OID value |
static void |
encode(ByteBuffer buffer,
String string)
Encode a String value |
static void |
encodeEnumerated(ByteBuffer buffer,
int value)
Encode an enumerated value |
static byte[] |
getBytes(int value)
Utility function that return a byte array representing the Value We must respect the ASN.1 BER encoding scheme : 1) positive integer - [0 - 0x7F] : 0xVV - [0x80 - 0xFF] : 0x00 0xVV - [0x0100 - 0x7FFF] : 0xVV 0xVV - [0x8000 - 0xFFFF] : 0x00 0xVV 0xVV - [0x010000 - 0x7FFFFF] : 0xVV 0xVV 0xVV - [0x800000 - 0xFFFFFF] : 0x00 0xVV 0xVV 0xVV - [0x01000000 - 0x7FFFFFFF] : 0xVV 0xVV 0xVV 0xVV 2) Negative number - (~value) + 1 |
static byte[] |
getBytes(long value)
Utility function that return a byte array representing the Value. |
int |
getCurrentLength()
|
byte[] |
getData()
Get the Values'data |
static int |
getNbBytes(int value)
Utility function that return the number of bytes necessary to store an integer value. |
static int |
getNbBytes(long value)
Utility function that return the number of bytes necessary to store a long value. |
void |
init(int size)
Initialize the Value |
void |
reset()
Reset the Value so that it can be reused |
void |
setData(byte[] data)
Set a block of bytes in the Value |
void |
setData(ByteBuffer data)
Set a block of bytes in the Value |
String |
toString()
Return a string representing the Value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte TRUE_VALUE
public static final byte FALSE_VALUE
| Constructor Detail |
|---|
public Value(byte[] value)
value - the associated valuepublic Value()
| Method Detail |
|---|
public void init(int size)
size - The data size to allocate.public void reset()
public byte[] getData()
public void setData(ByteBuffer data)
data - The data to set.public void addData(ByteBuffer buffer)
buffer - The data to append.public void setData(byte[] data)
data - The data to set.public void addData(byte[] array)
array - The data to append.public int getCurrentLength()
public static int getNbBytes(int value)
value - The value to store in a byte array
public static int getNbBytes(long value)
value - The value to store in a byte array
public static byte[] getBytes(int value)
value - The value to store in a byte array
public static byte[] getBytes(long value)
value - The value to store in a byte array
public static void encode(ByteBuffer buffer,
String string)
throws EncoderException
buffer - The PDU in which the value will be putstring - The String to be encoded. It is supposed to be UTF-8
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encode(ByteBuffer buffer,
BitString bitString)
throws EncoderException
buffer - The PDU in which the value will be putbitString - The BitString to be encoded.
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encode(ByteBuffer buffer,
byte[] bytes)
throws EncoderException
buffer - The PDU in which the value will be putbytes - The bytes to be encoded
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encode(ByteBuffer buffer,
OID oid)
throws EncoderException
buffer - The PDU in which the value will be putoid - The OID to be encoded
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encode(ByteBuffer buffer,
int value)
throws EncoderException
buffer - The PDU in which the value will be putvalue - The integer to be encoded
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encode(ByteBuffer buffer,
long value)
throws EncoderException
buffer - The PDU in which the value will be putvalue - The long to be encoded
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encode(ByteBuffer buffer,
byte tag,
int value)
throws EncoderException
buffer - The PDU in which the value will be puttag - The tag if it's not an UNIVERSAL onevalue - The integer to be encoded
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encodeEnumerated(ByteBuffer buffer,
int value)
throws EncoderException
buffer - The PDU in which the value will be putvalue - The integer to be encoded
EncoderException - if the PDU in which the value should be encoded is
two small
public static void encode(ByteBuffer buffer,
boolean bool)
throws EncoderException
buffer - The PDU in which the value will be putbool - The boolean to be encoded
EncoderException - if the PDU in which the value should be encoded is
two smallpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||