java.lang.Object | |
↳ | com.sun.jmx.snmp.BerDecoder |
The BerDecoder
class is used for decoding
BER-encoded data.
A BerDecoder
needs to be set up with the byte string containing
the encoding. It maintains a current position in the byte string.
Methods allows to fetch integer, string, OID, etc., from the current
position. After a fetch the current position is moved forward.
A fetch throws a BerException
if the encoding is not of the
expected type.
This API is a Sun Microsystems internal API and is subject to change without notice.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | BooleanTag | ||||||||||
int | IntegerTag | ||||||||||
int | NullTag | ||||||||||
int | OctetStringTag | ||||||||||
int | OidTag | ||||||||||
int | SequenceTag |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new decoder and attaches it to the specified byte string.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return
true if the end of the current sequence is not reached. | |||||||||||
Close a sequence.
| |||||||||||
Fetch an
ANY value. | |||||||||||
Fetch an
ANY value with a specific tag. | |||||||||||
Fetch an integer with the specified tag.
| |||||||||||
Fetch an integer.
| |||||||||||
Fetch an integer and return a long value.
| |||||||||||
Fetch an integer with the specified tag and return a long value.
| |||||||||||
Fetch a
NULL value with a specified tag. | |||||||||||
Fetch a
NULL value. | |||||||||||
Fetch an octet string.
| |||||||||||
Fetch an octet string with a specified tag.
| |||||||||||
Fetch an object identifier.
| |||||||||||
Fetch an object identifier with a specified tag.
| |||||||||||
Get the tag of the data at the current position.
| |||||||||||
Fetch a sequence header with a specific tag.
| |||||||||||
Fetch a sequence header.
| |||||||||||
Returns a string representation of the object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Constructs a new decoder and attaches it to the specified byte string.
b | The byte string containing the encoded data. |
---|
Return true
if the end of the current sequence is not reached.
When this method returns false
, closeSequence
can (and must) be
invoked.
true
if there is still some data in the sequence.
Close a sequence. The decode pull the stack and verifies that the current position matches with the calculated end of the sequence. If not it throws an exception.
BerException | The sequence is not expected to finish here. |
---|
Fetch an ANY
value. In fact, this method does not decode anything
it simply returns the next TLV as an array of bytes.
BerException | The next TLV is really badly encoded... |
---|
Fetch an ANY
value with a specific tag.
tag | The expected tag. |
---|
BerException | The next TLV is really badly encoded... |
---|
Fetch an integer with the specified tag.
tag | The expected tag. |
---|
BerException | Current position does not point to an integer or the tag is not the expected one. |
---|
Fetch an integer.
BerException | Current position does not point to an integer. |
---|
Fetch an integer and return a long value.
BerException | Current position does not point to an integer. |
---|
Fetch an integer with the specified tag and return a long value.
tag | The expected tag. |
---|
BerException | Current position does not point to an integer or the tag is not the expected one. |
---|
Fetch a NULL
value with a specified tag.
tag | The expected tag. |
---|
BerException | Current position does not point to
NULL value or the tag is not the expected one.
|
---|
Fetch a NULL
value.
BerException | Current position does not point to NULL value.
|
---|
Fetch an octet string.
BerException | Current position does not point to an octet string. |
---|
Fetch an octet string with a specified tag.
tag | The expected tag. |
---|
BerException | Current position does not point to an octet string or the tag is not the expected one. |
---|
Fetch an object identifier.
BerException |
---|
Fetch an object identifier with a specified tag.
tag | The expected tag. |
---|
BerException | Current position does not point to an oid or the tag is not the expected one. |
---|
Get the tag of the data at the current position. Current position is unchanged.
BerException |
---|
Fetch a sequence header with a specific tag.
tag | The expected tag. |
---|
BerException | Current position does not point to a sequence header or the tag is not the expected one. |
---|
Fetch a sequence header. The decoder computes the end position of the sequence and push it on its stack.
BerException | Current position does not point to a sequence header. |
---|
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())