| java.lang.Object com.sun.jndi.ldap.Ber com.sun.jndi.ldap.BerEncoder
BerEncoder | final public class BerEncoder extends Ber (Code) | | A BER encoder.
author: Jagane Sundar author: Scott Seligman author: Vincent Ryan |
Constructor Summary | |
public | BerEncoder() Creates a BER buffer for encoding. | public | BerEncoder(int bufsize) Creates a BER buffer of a specified size for encoding.
Specify the initial bufsize. |
Method Summary | |
public void | beginSeq(int tag) Begin encoding a sequence with a tag. | public void | encodeBoolean(boolean b) Encodes a boolean. | public void | encodeBoolean(boolean b, int tag) | public void | encodeByte(int b) Encode a single byte. | public void | encodeInt(int i) | public void | encodeInt(int i, int tag) Encodes an int and a tag. | public void | encodeOctetString(byte tb, int tag, int tboffset, int length) Encodes a portion of an octet string and a tag. | public void | encodeOctetString(byte tb, int tag) Encodes an octet string and a tag. | public void | encodeString(String str, boolean encodeUTF8) Encodes a string. | public void | encodeString(String str, int tag, boolean encodeUTF8) Encodes a string and a tag. | public void | encodeStringArray(String strs, boolean encodeUTF8) Encodes an array of strings. | public void | endSeq() Terminate a BER sequence. | public byte[] | getBuf() Gets the buffer that contains the BER encoding. | public int | getDataLen() Gets the number of encoded bytes in this BER buffer. | public byte[] | getTrimmedBuf() Gets the buffer that contains the BER encoding, trimming unused bytes. | public void | reset() Resets encoder to state when newly constructed. |
BerEncoder | public BerEncoder()(Code) | | Creates a BER buffer for encoding.
|
BerEncoder | public BerEncoder(int bufsize)(Code) | | Creates a BER buffer of a specified size for encoding.
Specify the initial bufsize. Buffer will be expanded as needed.
Parameters: bufsize - The number of bytes for the buffer. |
beginSeq | public void beginSeq(int tag)(Code) | | Begin encoding a sequence with a tag.
|
encodeBoolean | public void encodeBoolean(boolean b)(Code) | | Encodes a boolean.
BER boolean ::= 0x01 0x01 {0xff|0x00}
|
encodeBoolean | public void encodeBoolean(boolean b, int tag)(Code) | | Encodes a boolean and a tag
BER boolean w TAG ::= tag 0x01 {0xff|0x00}
|
encodeByte | public void encodeByte(int b)(Code) | | Encode a single byte.
|
encodeInt | public void encodeInt(int i)(Code) | | |
encodeInt | public void encodeInt(int i, int tag)(Code) | | Encodes an int and a tag.
BER integer w tag ::= tag berlength byte {byte}*
|
encodeOctetString | public void encodeOctetString(byte tb, int tag, int tboffset, int length) throws EncodeException(Code) | | Encodes a portion of an octet string and a tag.
|
encodeOctetString | public void encodeOctetString(byte tb, int tag) throws EncodeException(Code) | | Encodes an octet string and a tag.
|
encodeString | public void encodeString(String str, boolean encodeUTF8) throws EncodeException(Code) | | Encodes a string.
BER string ::= 0x04 strlen byte1 byte2...
The string is converted into bytes using UTF-8 or ISO-Latin-1.
|
encodeString | public void encodeString(String str, int tag, boolean encodeUTF8) throws EncodeException(Code) | | Encodes a string and a tag.
BER string w TAG ::= tag strlen byte1 byte2...
|
encodeStringArray | public void encodeStringArray(String strs, boolean encodeUTF8) throws EncodeException(Code) | | Encodes an array of strings.
|
endSeq | public void endSeq() throws EncodeException(Code) | | Terminate a BER sequence.
|
getBuf | public byte[] getBuf()(Code) | | Gets the buffer that contains the BER encoding. Throws an
exception if unmatched beginSeq() and endSeq() pairs were
encountered. Not entire buffer contains encoded bytes.
Use getDataLen() to determine number of encoded bytes.
Use getBuffer(true) to get rid of excess bytes in array.
throws: IllegalStateException - If buffer contains unbalanced sequence. |
getDataLen | public int getDataLen()(Code) | | Gets the number of encoded bytes in this BER buffer.
|
getTrimmedBuf | public byte[] getTrimmedBuf()(Code) | | Gets the buffer that contains the BER encoding, trimming unused bytes.
throws: IllegalStateException - If buffer contains unbalanced sequence. |
reset | public void reset()(Code) | | Resets encoder to state when newly constructed. Zeros out
internal data structures.
|
|
|