LDAP Classes
Implements Java LDAP

com.novell.ldap.asn1
Class LBEREncoder

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

public class LBEREncoder
extends java.lang.Object
implements ASN1Encoder

This class provides LBER encoding 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
    LBEREncoder()
               
     
    Method Summary
     void encode(ASN1Boolean b, java.io.OutputStream out)
              BER Encode an ASN1Boolean directly into the specified output stream.
     void encode(ASN1Identifier id, java.io.OutputStream out)
              Encode an ASN1Identifier directly into the specified outputstream.
     void encode(ASN1Null n, java.io.OutputStream out)
              Encode an ASN1Null directly into the specified outputstream.
     void encode(ASN1Numeric n, java.io.OutputStream out)
              Encode an ASN1Numeric directly into the specified outputstream.
     void encode(ASN1OctetString os, java.io.OutputStream out)
              Encode an ASN1OctetString directly into the specified outputstream.
     void encode(ASN1Structured c, java.io.OutputStream out)
              Encode an ASN1Structured into the specified outputstream.
     void encode(ASN1Tagged t, java.io.OutputStream out)
              Encode an ASN1Tagged directly into the specified outputstream.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    LBEREncoder

    public LBEREncoder()
    Method Detail

    encode

    public void encode(ASN1Boolean b,
                       java.io.OutputStream out)
                throws java.io.IOException
    BER Encode an ASN1Boolean directly into the specified output stream.

    Specified by:
    encode in interface ASN1Encoder
    Parameters:
    b - The ASN1Boolean object to encode
    out - The output stream onto which the ASN.1 object is to be encoded
    Throws:
    java.io.IOException

    encode

    public final void encode(ASN1Numeric n,
                             java.io.OutputStream out)
                      throws java.io.IOException
    Encode an ASN1Numeric directly into the specified outputstream.

    Use a two's complement representation in the fewest number of octets possible.

    Can be used to encode INTEGER and ENUMERATED values.

    Specified by:
    encode in interface ASN1Encoder
    Parameters:
    n - The ASN1Numeric object to encode
    out - The output stream onto which the ASN.1 object is to be encoded
    Throws:
    java.io.IOException

    encode

    public final void encode(ASN1Null n,
                             java.io.OutputStream out)
                      throws java.io.IOException
    Encode an ASN1Null directly into the specified outputstream.

    Specified by:
    encode in interface ASN1Encoder
    Parameters:
    n - The ASN1Null object to encode
    out - The output stream onto which the ASN.1 object is to be encoded
    Throws:
    java.io.IOException

    encode

    public final void encode(ASN1OctetString os,
                             java.io.OutputStream out)
                      throws java.io.IOException
    Encode an ASN1OctetString directly into the specified outputstream.

    Specified by:
    encode in interface ASN1Encoder
    Parameters:
    os - The ASN1OctetString object to encode
    out - The output stream onto which the ASN.1 object is to be encoded
    Throws:
    java.io.IOException

    encode

    public final void encode(ASN1Structured c,
                             java.io.OutputStream out)
                      throws java.io.IOException
    Encode an ASN1Structured into the specified outputstream. This method can be used to encode SET, SET_OF, SEQUENCE, SEQUENCE_OF

    Specified by:
    encode in interface ASN1Encoder
    Parameters:
    c - The ASN1Structured object to encode
    out - The output stream onto which the ASN.1 object is to be encoded
    Throws:
    java.io.IOException

    encode

    public final void encode(ASN1Tagged t,
                             java.io.OutputStream out)
                      throws java.io.IOException
    Encode an ASN1Tagged directly into the specified outputstream.

    Specified by:
    encode in interface ASN1Encoder
    Parameters:
    t - The ASN1Tagged object to encode
    out - The output stream onto which the ASN.1 object is to be encoded
    Throws:
    java.io.IOException

    encode

    public final void encode(ASN1Identifier id,
                             java.io.OutputStream out)
                      throws java.io.IOException
    Encode an ASN1Identifier directly into the specified outputstream.

    Specified by:
    encode in interface ASN1Encoder
    Parameters:
    id - The ASN1Identifier object to encode
    out - The output stream onto which the ASN.1 object is to be encoded
    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