Package netscape.ldap.ber.stream
Class BERElement
java.lang.Object
netscape.ldap.ber.stream.BERElement
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BERAny
,BERBitString
,BERBoolean
,BERCharacterString
,BERChoice
,BERConstruct
,BERIntegral
,BERNull
,BERObjectId
,BEROctetString
,BERReal
,BERTag
,BERUTCTime
This class is for the tagged object type. A nested tag is
allowed. A tagged element contains another BER element.
- Version:
- 1.0 seeAlso CCITT X.209
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
Possible element types.static final int
static final int
static final int
static final int
static final int
Possible tags.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Internal (non-transmitted) tags.static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyteToHexString
(byte value) Converts byte to hex string.static BERElement
getElement
(BERTagDecoder decoder, InputStream stream, int[] bytes_read) Gets a ber element from the input stream.abstract int
getType()
Gets the element type.static int
readLengthOctets
(InputStream stream, int[] bytes_read) Reads and decodes a length byte and then that many octets from the input stream.protected int
readTwosComplement
(InputStream stream, int[] bytes_read, int length) Reads the two's complement representation of an integer from an input stream.protected int
readUnsignedBinary
(InputStream stream, int[] bytes_read, int length) Reads a number of bytes from an input stream and form an integer..static void
sendDefiniteLength
(OutputStream stream, int num_content_octets) Writes length octets (definite length only) to stream.abstract String
toString()
Gets the string representation.abstract void
write
(OutputStream stream) Sends the BER encoding directly to a stream.
-
Field Details
-
BOOLEAN
public static final int BOOLEANPossible element types.- See Also:
-
INTEGER
public static final int INTEGER- See Also:
-
BITSTRING
public static final int BITSTRING- See Also:
-
OCTETSTRING
public static final int OCTETSTRING- See Also:
-
NULL
public static final int NULL- See Also:
-
OBJECTID
public static final int OBJECTID- See Also:
-
REAL
public static final int REAL- See Also:
-
ENUMERATED
public static final int ENUMERATED- See Also:
-
SET
public static final int SET- See Also:
-
SEQUENCE
public static final int SEQUENCE- See Also:
-
NUMERICSTRING
public static final int NUMERICSTRING- See Also:
-
PRINTABLESTRING
public static final int PRINTABLESTRING- See Also:
-
TELETEXSTRING
public static final int TELETEXSTRING- See Also:
-
VIDEOTEXSTRING
public static final int VIDEOTEXSTRING- See Also:
-
IA5STRING
public static final int IA5STRING- See Also:
-
UTCTIME
public static final int UTCTIME- See Also:
-
GRAPHICSTRING
public static final int GRAPHICSTRING- See Also:
-
VISIBLESTRING
public static final int VISIBLESTRING- See Also:
-
GENERALSTRING
public static final int GENERALSTRING- See Also:
-
TAG
public static final int TAGInternal (non-transmitted) tags.- See Also:
-
CHOICE
public static final int CHOICE- See Also:
-
ANY
public static final int ANY- See Also:
-
EOC
public static final int EOCPossible tags.- See Also:
-
UNIVERSAL
public static final int UNIVERSAL- See Also:
-
APPLICATION
public static final int APPLICATION- See Also:
-
CONTEXT
public static final int CONTEXT- See Also:
-
SASLCONTEXT
public static final int SASLCONTEXT- See Also:
-
PRIVATE
public static final int PRIVATE- See Also:
-
PRIMITIVE
public static final int PRIMITIVE- See Also:
-
CONSTRUCTED
public static final int CONSTRUCTED- See Also:
-
MRA_OID
public static final int MRA_OID- See Also:
-
MRA_TYPE
public static final int MRA_TYPE- See Also:
-
MRA_VALUE
public static final int MRA_VALUE- See Also:
-
MRA_DNATTRS
public static final int MRA_DNATTRS- See Also:
-
EXOP_REQ_OID
public static final int EXOP_REQ_OID- See Also:
-
EXOP_REQ_VALUE
public static final int EXOP_REQ_VALUE- See Also:
-
EXOP_RES_OID
public static final int EXOP_RES_OID- See Also:
-
EXOP_RES_VALUE
public static final int EXOP_RES_VALUE- See Also:
-
SK_MATCHRULE
public static final int SK_MATCHRULE- See Also:
-
SK_REVERSE
public static final int SK_REVERSE- See Also:
-
SR_ATTRTYPE
public static final int SR_ATTRTYPE- See Also:
-
-
Constructor Details
-
BERElement
public BERElement()
-
-
Method Details
-
getElement
public static BERElement getElement(BERTagDecoder decoder, InputStream stream, int[] bytes_read) throws IOException Gets a ber element from the input stream.- Parameters:
decoder
- decoder for application specific BERstream
- source of ber encodingbytes_read
- array of 1 int; value incremented by number of bytes read from stream- Throws:
IOException
- failed to decode an element.
-
readLengthOctets
Reads and decodes a length byte and then that many octets from the input stream.- Parameters:
stream
- input stream from which to readbytes_read
- array of 1 int; value incremented by number of bytes read from stream- Returns:
- length of contents or -1 if indefinite length.
- Throws:
IOException
- failed to read octets
-
sendDefiniteLength
public static void sendDefiniteLength(OutputStream stream, int num_content_octets) throws IOException Writes length octets (definite length only) to stream. Uses shortform whenever possible.- Parameters:
stream
- output stream to write tonum_content_octets
- value to be encode into length octets- Throws:
IOException
- failed to read octets
-
readUnsignedBinary
protected int readUnsignedBinary(InputStream stream, int[] bytes_read, int length) throws IOException Reads a number of bytes from an input stream and form an integer..- Parameters:
stream
- source of databytes_read
- number of bytes readlength
- number of bytes to be read (1 to 4)- Returns:
- the value of the data as two's complement.
- Throws:
IOException
- failed to read octets
-
readTwosComplement
protected int readTwosComplement(InputStream stream, int[] bytes_read, int length) throws IOException Reads the two's complement representation of an integer from an input stream.- Parameters:
stream
- source of databytes_read
- number of bytes readlength
- number of bytes to be read- Returns:
- the integer value as two's complement.
- Throws:
IOException
- failed to read octets
-
byteToHexString
Converts byte to hex string.- Parameters:
value
- byte value- Returns:
- string representation of Hex String
-
write
Sends the BER encoding directly to a stream.- Parameters:
stream
- output stream- Throws:
IOException
-
getType
public abstract int getType()Gets the element type.- Returns:
- element type.
-
toString
Gets the string representation.
-