public final class BerDecoder extends Ber
ASN_APPLICATION, ASN_BIT_STRING, ASN_BOOLEAN, ASN_CONSTRUCTOR, ASN_CONTEXT, ASN_ENUMERATED, ASN_INTEGER, ASN_NULL, ASN_OBJECT_ID, ASN_OCTET_STR, ASN_PRIMITIVE, ASN_PRIVATE, ASN_SEQUENCE, ASN_SET, ASN_SIMPLE_STRING, ASN_UNIVERSAL, buf, bufsize, offset
Constructor and Description |
---|
BerDecoder(byte[] buf,
int offset,
int bufsize)
Creates a BER decoder that reads bytes from the specified buffer.
|
Modifier and Type | Method and Description |
---|---|
int |
bytesLeft()
Returns the number of unparsed bytes in this BER buffer.
|
int |
getParsePosition()
Returns the current parse position.
|
boolean |
parseBoolean()
Parses an ASN_BOOLEAN tagged integer from this BER buffer.
|
int |
parseByte()
Parses the next byte in this BER buffer.
|
int |
parseEnumeration()
Parses an ASN_ENUMERATED tagged integer from this BER buffer.
|
int |
parseInt()
Parses an ASN_INTEGER tagged integer from this BER buffer.
|
protected int |
parseIntWithTag(int tag)
Parses an integer that's preceded by a tag.
|
int |
parseLength()
Parses a possibly variable length field.
|
byte[] |
parseOctetString(int tag,
int[] rlen)
Parses an octet string of a given type(tag) from this BER buffer.
|
int |
parseSeq(int[] rlen)
Parses the next sequence in this BER buffer.
|
String |
parseString(boolean decodeUTF8)
Parses a string.
|
String |
parseStringWithTag(int tag,
boolean decodeUTF8,
int[] rlen)
Parses a string of a given tag from this BER buffer.
|
int |
peekByte()
Returns the next byte in this BER buffer without consuming it.
|
void |
reset()
Resets this decode to start parsing from the initial offset
(ie., same state as after calling the constructor).
|
public BerDecoder(byte[] buf, int offset, int bufsize)
public void reset()
public int getParsePosition()
public int parseLength() throws davmail.ldap.Ber.DecodeException
davmail.ldap.Ber.DecodeException
public int parseSeq(int[] rlen) throws davmail.ldap.Ber.DecodeException
rlen
- An array for returning size of the sequence in bytes. If null,
the size is not returned.davmail.ldap.Ber.DecodeException
public int parseByte() throws davmail.ldap.Ber.DecodeException
davmail.ldap.Ber.DecodeException
public int peekByte() throws davmail.ldap.Ber.DecodeException
davmail.ldap.Ber.DecodeException
public boolean parseBoolean() throws davmail.ldap.Ber.DecodeException
davmail.ldap.Ber.DecodeException
public int parseEnumeration() throws davmail.ldap.Ber.DecodeException
davmail.ldap.Ber.DecodeException
public int parseInt() throws davmail.ldap.Ber.DecodeException
davmail.ldap.Ber.DecodeException
protected int parseIntWithTag(int tag) throws davmail.ldap.Ber.DecodeException
BER integer ::= tag length byte {byte}*
davmail.ldap.Ber.DecodeException
public String parseString(boolean decodeUTF8) throws davmail.ldap.Ber.DecodeException
davmail.ldap.Ber.DecodeException
public String parseStringWithTag(int tag, boolean decodeUTF8, int[] rlen) throws davmail.ldap.Ber.DecodeException
BER simple string ::= tag length {byte}*
rlen
- An array for holding the relative parsed offset; if null
offset not set.decodeUTF8
- If true, use UTF-8 when decoding the string; otherwise
use ISO-Latin-1 (8859_1). Use true for LDAPv3; false for LDAPv2.tag
- The tag that precedes the string.davmail.ldap.Ber.DecodeException
public byte[] parseOctetString(int tag, int[] rlen) throws davmail.ldap.Ber.DecodeException
BER Binary Data of type "tag" ::= tag length {byte}*
tag
- The tag to look for.rlen
- An array for returning the relative parsed position. If null,
the relative parsed position is not returned.DecodeException
- If the next byte in the BER buffer is not
tag
, or if length specified in the BER buffer exceeds the
number of bytes left in the buffer.davmail.ldap.Ber.DecodeException
public int bytesLeft()
Copyright © 2001–2024 MickaĆ«l Guessant. All rights reserved.