| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private int | |
| private static final int | |
| private static final int | |
| private int[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | BerEncoder(int
The number of bytes for the buffer. bufsize)Creates a BER buffer of a specified size for encoding. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | encodeBoolean(boolean b, int tag)
Encodes a boolean and a tag
|
| public void | |
| public void | |
| public void | |
| private void | |
| private void | |
| public void | encodeOctetString(byte[] tb, int tag, int tboffset, int length)
Encodes a portion of an octet string and a tag. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| private void | |
| public byte[] | |
| public int | |
| public byte[] | |
| public void | |
| private void | shiftSeqData(int start, int len, int shift)
Shifts contents of buf in the range [start,start+len) a specified amount. |
| BUF_GROWTH_FACTOR | back to summary |
|---|---|
| private static final int BUF_GROWTH_FACTOR | |
| curSeqIndex | back to summary |
|---|---|
| private int curSeqIndex | |
| DEFAULT_BUFSIZE | back to summary |
|---|---|
| private static final int DEFAULT_BUFSIZE | |
| INITIAL_SEQUENCES | back to summary |
|---|---|
| private static final int INITIAL_SEQUENCES | |
| seqOffset | back to summary |
|---|---|
| private int[] seqOffset | |
| BerEncoder | back to summary |
|---|---|
| public BerEncoder() Creates a BER buffer for encoding. | |
| BerEncoder | back to summary |
|---|---|
| public BerEncoder(int bufsize) Creates a BER buffer of a specified size for encoding. Specify the initial bufsize. Buffer will be expanded as needed.
| |
| beginSeq | back to summary |
|---|---|
| public void beginSeq(int tag) Begin encoding a sequence with a tag. | |
| encodeBoolean | back to summary |
|---|---|
| public void encodeBoolean(boolean b) Encodes a boolean.
| |
| encodeBoolean | back to summary |
|---|---|
| public void encodeBoolean(boolean b, int tag) Encodes a boolean and a tag
| |
| encodeByte | back to summary |
|---|---|
| public void encodeByte(int b) Encode a single byte. | |
| encodeInt | back to summary |
|---|---|
| public void encodeInt(int i) | |
| encodeInt | back to summary |
|---|---|
| public void encodeInt(int i, int tag) Encodes an int and a tag.
| |
| encodeInt | back to summary |
|---|---|
| private void encodeInt(int i, int tag, int intsize) | |
| encodeLength | back to summary |
|---|---|
| private void encodeLength(int len) throws EncodeException | |
| encodeOctetString | back to summary |
|---|---|
| public void encodeOctetString(byte[] tb, int tag, int tboffset, int length) throws EncodeException Encodes a portion of an octet string and a tag. | |
| encodeOctetString | back to summary |
|---|---|
| public void encodeOctetString(byte[] tb, int tag) throws EncodeException Encodes an octet string and a tag. | |
| encodeString | back to summary |
|---|---|
| public void encodeString(String str, boolean encodeUTF8) throws EncodeException Encodes a string. The string is converted into bytes using UTF-8 or ISO-Latin-1.BER string ::= 0x04 strlen byte1 byte2... | |
| encodeString | back to summary |
|---|---|
| public void encodeString(String str, int tag, boolean encodeUTF8) throws EncodeException Encodes a string and a tag. BER string w TAG ::= tag strlen byte1 byte2... | |
| encodeStringArray | back to summary |
|---|---|
| public void encodeStringArray(String[] strs, boolean encodeUTF8) throws EncodeException Encodes an array of strings. | |
| endSeq | back to summary |
|---|---|
| public void endSeq() throws EncodeException Terminate a BER sequence. | |
| ensureFreeBytes | back to summary |
|---|---|
| private void ensureFreeBytes(int len) Ensures that there are at least "len" unused bytes in "buf". When more space is needed "buf" is expanded by a factor of BUF_GROWTH_FACTOR, then "len" bytes are added if "buf" still isn't large enough. | |
| getBuf | back to summary |
|---|---|
| public byte[] getBuf() 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.
| |
| getDataLen | back to summary |
|---|---|
| public int getDataLen() Gets the number of encoded bytes in this BER buffer. | |
| getTrimmedBuf | back to summary |
|---|---|
| public byte[] getTrimmedBuf() Gets the buffer that contains the BER encoding, trimming unused bytes.
| |
| reset | back to summary |
|---|---|
| public void reset() Resets encoder to state when newly constructed. Zeros out internal data structures. | |
| shiftSeqData | back to summary |
|---|---|
| private void shiftSeqData(int start, int len, int shift) Shifts contents of buf in the range [start,start+len) a specified amount. Positive shift value means shift to the right. | |