|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.BerEncoder
public class BerEncoder
The BerEncoder
class is used for encoding data using BER.
A BerEncoder
needs to be set up with a byte buffer. The encoded
data are stored in this byte buffer.
NOTE : the buffer is filled from end to start. This means the caller needs to encode its data in the reverse order.
Field Summary | |
---|---|
static int |
BooleanTag
|
protected byte[] |
bytes
|
static int |
IntegerTag
|
static int |
NullTag
|
static int |
OctetStringTag
|
static int |
OidTag
|
static int |
SequenceTag
|
protected int[] |
stackBuf
|
protected int |
stackTop
|
protected int |
start
|
Constructor Summary | |
---|---|
BerEncoder(byte[] b)
Constructs a new encoder and attaches it to the specified byte string. |
Method Summary | |
---|---|
void |
closeSequence()
Close a sequence. |
void |
closeSequence(int tag)
Close a sequence with the specified tag. |
void |
openSequence()
Open a sequence. |
void |
putAny(byte[] s)
Put an ANY value. |
void |
putAny(byte[] s,
int byteCount)
Put an ANY value. |
void |
putInteger(int v)
Put an integer. |
void |
putInteger(int v,
int tag)
Put an integer with the specified tag. |
void |
putInteger(long v)
Put an integer expressed as a long. |
void |
putInteger(long v,
int tag)
Put an integer expressed as a long with the specified tag. |
protected void |
putIntegerValue(int v)
Put an integer value and move the current position backward. |
protected void |
putIntegerValue(long v)
Put an integer value expressed as a long. |
protected void |
putLength(int length)
Put a length and move the current position backward. |
void |
putNull()
Put a NULL value. |
void |
putNull(int tag)
Put a NULL value with a specified tag. |
void |
putOctetString(byte[] s)
Put an octet string. |
void |
putOctetString(byte[] s,
int tag)
Put an octet string with a specified tag. |
void |
putOid(long[] s)
Put an object identifier. |
void |
putOid(long[] s,
int tag)
Put an object identifier with a specified tag. |
protected void |
putOidValue(long[] s)
Put an oid and move the current position backward. |
protected void |
putStringValue(byte[] s)
Put a byte string and move the current position backward. |
protected void |
putTag(int tag)
Put a tag and move the current position backward. |
void |
putUnsignedLong(long v,
int tag)
|
protected void |
putUnsignedLongValue(long v)
Put an unsigned long value and move the current position backward. |
int |
trim()
Trim the encoding data and returns the length of the encoding. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BooleanTag
public static final int IntegerTag
public static final int OctetStringTag
public static final int NullTag
public static final int OidTag
public static final int SequenceTag
protected final byte[] bytes
protected int start
protected final int[] stackBuf
protected int stackTop
Constructor Detail |
---|
public BerEncoder(byte[] b)
b
- The byte string containing the encoded data.Method Detail |
---|
public int trim()
trim
method.
After a call to the trim
method, the encoder is reinitialized and putXXX
overwrite any existing encoded data.
public void putInteger(int v)
v
- The integer to encode.public void putInteger(int v, int tag)
v
- The integer to encode.tag
- The tag to encode.public void putInteger(long v)
v
- The long to encode.public void putInteger(long v, int tag)
v
- The long to encodetag
- The tag to encode.public void putOctetString(byte[] s)
s
- The bytes to encodepublic void putOctetString(byte[] s, int tag)
s
- The bytes to encodetag
- The tag to encode.public void putOid(long[] s)
s
- The oid to encode.public void putOid(long[] s, int tag)
s
- The integer to encode.tag
- The tag to encode.public void putNull()
NULL
value.
public void putNull(int tag)
NULL
value with a specified tag.
tag
- The tag to encode.public void putAny(byte[] s)
ANY
value. In fact, this method does not encode anything.
It simply copies the specified bytes into the encoding.
s
- The encoding of the ANY
value.public void putAny(byte[] s, int byteCount)
ANY
value. Only the first byteCount
are considered.
s
- The encoding of the ANY
value.byteCount
- The number of bytes of the encoding.public void putUnsignedLong(long v, int tag)
public void openSequence()
public void closeSequence()
public void closeSequence(int tag)
protected final void putTag(int tag)
tag
- The tag to encode.protected final void putLength(int length)
length
- The length to encode.protected final void putIntegerValue(int v)
v
- The integer to encode.protected final void putIntegerValue(long v)
v
- The integer to encode.protected void putUnsignedLongValue(long v)
v
- The unsigned long to encode.protected final void putStringValue(byte[] s)
s
- The byte string to encode.protected final void putOidValue(long[] s)
s
- The oid to encode.
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |