Package netscape.ldap.ber.stream
Class BERElement
- java.lang.Object
-
- netscape.ldap.ber.stream.BERElement
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
BERAny,BERBitString,BERBoolean,BERCharacterString,BERChoice,BERConstruct,BERIntegral,BERNull,BERObjectId,BEROctetString,BERReal,BERTag,BERUTCTime
public abstract class BERElement extends java.lang.Object implements java.io.SerializableThis 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intANYstatic intAPPLICATIONstatic intBITSTRINGstatic intBOOLEANPossible element types.static intCHOICEstatic intCONSTRUCTEDstatic intCONTEXTstatic intENUMERATEDstatic intEOCPossible tags.static intEXOP_REQ_OIDstatic intEXOP_REQ_VALUEstatic intEXOP_RES_OIDstatic intEXOP_RES_VALUEstatic intGENERALSTRINGstatic intGRAPHICSTRINGstatic intIA5STRINGstatic intINTEGERstatic intMRA_DNATTRSstatic intMRA_OIDstatic intMRA_TYPEstatic intMRA_VALUEstatic intNULLstatic intNUMERICSTRINGstatic intOBJECTIDstatic intOCTETSTRINGstatic intPRIMITIVEstatic intPRINTABLESTRINGstatic intPRIVATEstatic intREALstatic intSASLCONTEXTstatic intSEQUENCEstatic intSETstatic intSK_MATCHRULEstatic intSK_REVERSEstatic intSR_ATTRTYPEstatic intTAGInternal (non-transmitted) tags.static intTELETEXSTRINGstatic intUNIVERSALstatic intUTCTIMEstatic intVIDEOTEXSTRINGstatic intVISIBLESTRING
-
Constructor Summary
Constructors Constructor Description BERElement()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringbyteToHexString(byte value)Converts byte to hex string.static BERElementgetElement(BERTagDecoder decoder, java.io.InputStream stream, int[] bytes_read)Gets a ber element from the input stream.abstract intgetType()Gets the element type.static intreadLengthOctets(java.io.InputStream stream, int[] bytes_read)Reads and decodes a length byte and then that many octets from the input stream.protected intreadTwosComplement(java.io.InputStream stream, int[] bytes_read, int length)Reads the two's complement representation of an integer from an input stream.protected intreadUnsignedBinary(java.io.InputStream stream, int[] bytes_read, int length)Reads a number of bytes from an input stream and form an integer..static voidsendDefiniteLength(java.io.OutputStream stream, int num_content_octets)Writes length octets (definite length only) to stream.abstract java.lang.StringtoString()Gets the string representation.abstract voidwrite(java.io.OutputStream stream)Sends the BER encoding directly to a stream.
-
-
-
Field Detail
-
BOOLEAN
public static final int BOOLEAN
Possible element types.- See Also:
- Constant Field Values
-
INTEGER
public static final int INTEGER
- See Also:
- Constant Field Values
-
BITSTRING
public static final int BITSTRING
- See Also:
- Constant Field Values
-
OCTETSTRING
public static final int OCTETSTRING
- See Also:
- Constant Field Values
-
NULL
public static final int NULL
- See Also:
- Constant Field Values
-
OBJECTID
public static final int OBJECTID
- See Also:
- Constant Field Values
-
REAL
public static final int REAL
- See Also:
- Constant Field Values
-
ENUMERATED
public static final int ENUMERATED
- See Also:
- Constant Field Values
-
SET
public static final int SET
- See Also:
- Constant Field Values
-
SEQUENCE
public static final int SEQUENCE
- See Also:
- Constant Field Values
-
NUMERICSTRING
public static final int NUMERICSTRING
- See Also:
- Constant Field Values
-
PRINTABLESTRING
public static final int PRINTABLESTRING
- See Also:
- Constant Field Values
-
TELETEXSTRING
public static final int TELETEXSTRING
- See Also:
- Constant Field Values
-
VIDEOTEXSTRING
public static final int VIDEOTEXSTRING
- See Also:
- Constant Field Values
-
IA5STRING
public static final int IA5STRING
- See Also:
- Constant Field Values
-
UTCTIME
public static final int UTCTIME
- See Also:
- Constant Field Values
-
GRAPHICSTRING
public static final int GRAPHICSTRING
- See Also:
- Constant Field Values
-
VISIBLESTRING
public static final int VISIBLESTRING
- See Also:
- Constant Field Values
-
GENERALSTRING
public static final int GENERALSTRING
- See Also:
- Constant Field Values
-
TAG
public static final int TAG
Internal (non-transmitted) tags.- See Also:
- Constant Field Values
-
CHOICE
public static final int CHOICE
- See Also:
- Constant Field Values
-
ANY
public static final int ANY
- See Also:
- Constant Field Values
-
EOC
public static final int EOC
Possible tags.- See Also:
- Constant Field Values
-
UNIVERSAL
public static final int UNIVERSAL
- See Also:
- Constant Field Values
-
APPLICATION
public static final int APPLICATION
- See Also:
- Constant Field Values
-
CONTEXT
public static final int CONTEXT
- See Also:
- Constant Field Values
-
SASLCONTEXT
public static final int SASLCONTEXT
- See Also:
- Constant Field Values
-
PRIVATE
public static final int PRIVATE
- See Also:
- Constant Field Values
-
PRIMITIVE
public static final int PRIMITIVE
- See Also:
- Constant Field Values
-
CONSTRUCTED
public static final int CONSTRUCTED
- See Also:
- Constant Field Values
-
MRA_OID
public static final int MRA_OID
- See Also:
- Constant Field Values
-
MRA_TYPE
public static final int MRA_TYPE
- See Also:
- Constant Field Values
-
MRA_VALUE
public static final int MRA_VALUE
- See Also:
- Constant Field Values
-
MRA_DNATTRS
public static final int MRA_DNATTRS
- See Also:
- Constant Field Values
-
EXOP_REQ_OID
public static final int EXOP_REQ_OID
- See Also:
- Constant Field Values
-
EXOP_REQ_VALUE
public static final int EXOP_REQ_VALUE
- See Also:
- Constant Field Values
-
EXOP_RES_OID
public static final int EXOP_RES_OID
- See Also:
- Constant Field Values
-
EXOP_RES_VALUE
public static final int EXOP_RES_VALUE
- See Also:
- Constant Field Values
-
SK_MATCHRULE
public static final int SK_MATCHRULE
- See Also:
- Constant Field Values
-
SK_REVERSE
public static final int SK_REVERSE
- See Also:
- Constant Field Values
-
SR_ATTRTYPE
public static final int SR_ATTRTYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getElement
public static BERElement getElement(BERTagDecoder decoder, java.io.InputStream stream, int[] bytes_read) throws java.io.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:
java.io.IOException- failed to decode an element.
-
readLengthOctets
public static int readLengthOctets(java.io.InputStream stream, int[] bytes_read) throws java.io.IOExceptionReads 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:
java.io.IOException- failed to read octets
-
sendDefiniteLength
public static void sendDefiniteLength(java.io.OutputStream stream, int num_content_octets) throws java.io.IOExceptionWrites 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:
java.io.IOException- failed to read octets
-
readUnsignedBinary
protected int readUnsignedBinary(java.io.InputStream stream, int[] bytes_read, int length) throws java.io.IOExceptionReads 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:
java.io.IOException- failed to read octets
-
readTwosComplement
protected int readTwosComplement(java.io.InputStream stream, int[] bytes_read, int length) throws java.io.IOExceptionReads 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:
java.io.IOException- failed to read octets
-
byteToHexString
public java.lang.String byteToHexString(byte value)
Converts byte to hex string.- Parameters:
value- byte value- Returns:
- string representation of Hex String
-
write
public abstract void write(java.io.OutputStream stream) throws java.io.IOExceptionSends the BER encoding directly to a stream.- Parameters:
stream- output stream- Throws:
java.io.IOException
-
getType
public abstract int getType()
Gets the element type.- Returns:
- element type.
-
toString
public abstract java.lang.String toString()
Gets the string representation.- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation of an element.
-
-