LDAP Classes
Implements Java LDAP

com.novell.ldap.asn1
Class LBERDecoder

java.lang.Object
  extended bycom.novell.ldap.asn1.LBERDecoder
All Implemented Interfaces:
ASN1Decoder, java.io.Serializable

public class LBERDecoder
extends java.lang.Object
implements ASN1Decoder

This class provides LBER decoding routines for ASN.1 Types. LBER is a subset of BER as described in the following taken from 5.1 of RFC 2251:

5.1. Mapping Onto BER-based Transport Services The protocol elements of LDAP are encoded for exchange using the Basic Encoding Rules (BER) [11] of ASN.1 [3]. However, due to the high overhead involved in using certain elements of the BER, the following additional restrictions are placed on BER-encodings of LDAP protocol elements:

  • (1) Only the definite form of length encoding will be used.
  • (2) OCTET STRING values will be encoded in the primitive form only.
  • (3) If the value of a BOOLEAN type is true, the encoding MUST have its contents octets set to hex "FF".
  • (4) If a value of a type is its default value, it MUST be absent. Only some BOOLEAN and INTEGER types have default values in this protocol definition.

    These restrictions do not apply to ASN.1 types encapsulated inside of OCTET STRING values, such as attribute values, unless otherwise noted.

    [3] ITU-T Rec. X.680, "Abstract Syntax Notation One (ASN.1) - Specification of Basic Notation", 1994.

    [11] ITU-T Rec. X.690, "Specification of ASN.1 encoding rules: Basic, Canonical, and Distinguished Encoding Rules", 1994.

    See Also:
    Serialized Form

    Constructor Summary
    LBERDecoder()
               
     
    Method Summary
     ASN1Object decode(byte[] value)
              Decode an LBER encoded value into an ASN1Type from a byte array.
     ASN1Object decode(java.io.InputStream in)
              Decode an LBER encoded value into an ASN1Type from an InputStream.
     ASN1Object decode(java.io.InputStream in, int[] len)
              Decode an LBER encoded value into an ASN1Object from an InputStream.
     java.lang.Object decodeBoolean(java.io.InputStream in, int len)
              Decode a boolean directly from a stream.
     java.lang.Object decodeCharacterString(java.io.InputStream in, int len)
              Decode a CharacterString directly from a stream.
     java.lang.Object decodeNumeric(java.io.InputStream in, int len)
              Decode a Numeric type directly from a stream.
     java.lang.Object decodeOctetString(java.io.InputStream in, int len)
              Decode an OctetString directly from a stream.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    LBERDecoder

    public LBERDecoder()
    Method Detail

    decode

    public ASN1Object decode(byte[] value)
    Decode an LBER encoded value into an ASN1Type from a byte array.

    Specified by:
    decode in interface ASN1Decoder
    Parameters:
    value - A byte array that points to the encoded ASN1 data

    decode

    public ASN1Object decode(java.io.InputStream in)
                      throws java.io.IOException
    Decode an LBER encoded value into an ASN1Type from an InputStream.

    Specified by:
    decode in interface ASN1Decoder
    Parameters:
    in - An input stream containig the encoded ASN.1 data.
    Throws:
    java.io.IOException

    decode

    public ASN1Object decode(java.io.InputStream in,
                             int[] len)
                      throws java.io.IOException
    Decode an LBER encoded value into an ASN1Object from an InputStream.

    This method also returns the total length of this encoded ASN1Object (length of type + length of length + length of content) in the parameter len. This information is helpful when decoding structured types.

    Specified by:
    decode in interface ASN1Decoder
    Parameters:
    len - The decoded components encoded length. This value is handy when decoding structured types. It allows you to accumulate the number of bytes decoded, so you know when the structured type has decoded all of its components.
    in - An input stream containig the encoded ASN.1 data.
    Throws:
    java.io.IOException

    decodeBoolean

    public final java.lang.Object decodeBoolean(java.io.InputStream in,
                                                int len)
                                         throws java.io.IOException
    Decode a boolean directly from a stream.

    Specified by:
    decodeBoolean in interface ASN1Decoder
    Parameters:
    in - An input stream containig the encoded ASN.1 data.
    len - Length in bytes
    Throws:
    java.io.IOException

    decodeNumeric

    public final java.lang.Object decodeNumeric(java.io.InputStream in,
                                                int len)
                                         throws java.io.IOException
    Decode a Numeric type directly from a stream. Decodes INTEGER and ENUMERATED types.

    Specified by:
    decodeNumeric in interface ASN1Decoder
    Parameters:
    in - An input stream containig the encoded ASN.1 data.
    len - Length in bytes
    Throws:
    java.io.IOException

    decodeOctetString

    public final java.lang.Object decodeOctetString(java.io.InputStream in,
                                                    int len)
                                             throws java.io.IOException
    Decode an OctetString directly from a stream.

    Specified by:
    decodeOctetString in interface ASN1Decoder
    Parameters:
    in - An input stream containig the encoded ASN.1 data.
    len - Length in bytes
    Throws:
    java.io.IOException

    decodeCharacterString

    public final java.lang.Object decodeCharacterString(java.io.InputStream in,
                                                        int len)
                                                 throws java.io.IOException
    Decode a CharacterString directly from a stream.

    Specified by:
    decodeCharacterString in interface ASN1Decoder
    Parameters:
    in - An input stream containig the encoded ASN.1 data.
    len - Length in bytes
    Throws:
    java.io.IOException

    LDAP Classes
    Implements Java LDAP

    Copyright © 2002 Novell, Inc. All Rights Reserved.
    Novell, Inc.
    1800 South Novell Place
    Provo, Ut 84606
    Phone: (801) 861-5000