LDAP Classes
Implements Java LDAP

com.novell.ldap.asn1
Class ASN1Identifier

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

public class ASN1Identifier
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class is used to encapsulate an ASN.1 Identifier.

An ASN1Identifier is composed of three parts:

  • a class type,
  • a form, and
  • a tag.

    The class type is defined as:

     bit 8 7 TAG CLASS
     ------- -----------
         0 0 UNIVERSAL
         0 1 APPLICATION
         1 0 CONTEXT
         1 1 PRIVATE
    

    The form is defined as:

     bit 6 FORM
     ----- --------
         0 PRIMITIVE
         1 CONSTRUCTED
    

    Note: CONSTRUCTED types are made up of other CONSTRUCTED or PRIMITIVE types.

    The tag is defined as:

     bit 5 4 3 2 1 TAG
     ------------- ---------------------------------------------
         0 0 0 0 0
         . . . . .
         1 1 1 1 0 (0-30) single octet tag
    
         1 1 1 1 1 (> 30) multiple octet tag, more octets follow
    

    See Also:
    Serialized Form

    Field Summary
    static int APPLICATION
              Application-wide tag class.
    static int CONTEXT
              Context-specific tag class.
    static int PRIVATE
              Private-use tag class.
    static int UNIVERSAL
              Universal tag class.
     
    Constructor Summary
    ASN1Identifier()
               
    ASN1Identifier(java.io.InputStream in)
              Decode an ASN1Identifier directly from an InputStream and save the encoded length of the ASN1Identifier.
    ASN1Identifier(int tagClass, boolean constructed, int tag)
              Constructs an ASN1Identifier using the classtype, form and tag.
     
    Method Summary
     java.lang.Object clone()
              Creates a duplicate, not a true clone, of this object and returns a reference to the duplicate.
     int getASN1Class()
              Returns the CLASS of this ASN1Identifier as an int value.
     boolean getConstructed()
              Return a boolean indicating if the constructed bit is set.
     int getEncodedLength()
              Returns the encoded length of this ASN1Identifier.
     int getTag()
              Returns the TAG of this ASN1Identifier.
     boolean isApplication()
              Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of APPLICATION.
     boolean isContext()
              Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of CONTEXT-SPECIFIC.
     boolean isPrivate()
              Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of PRIVATE.
     boolean isUniversal()
              Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of UNIVERSAL.
     void reset(java.io.InputStream in)
              Decode an ASN1Identifier directly from an InputStream and save the encoded length of the ASN1Identifier, but reuse the object.
     
    Methods inherited from class java.lang.Object
    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    UNIVERSAL

    public static final int UNIVERSAL
    Universal tag class.

    UNIVERSAL = 0

    See Also:
    Constant Field Values

    APPLICATION

    public static final int APPLICATION
    Application-wide tag class.

    APPLICATION = 1

    See Also:
    Constant Field Values

    CONTEXT

    public static final int CONTEXT
    Context-specific tag class.

    CONTEXT = 2

    See Also:
    Constant Field Values

    PRIVATE

    public static final int PRIVATE
    Private-use tag class.

    PRIVATE = 3

    See Also:
    Constant Field Values
    Constructor Detail

    ASN1Identifier

    public ASN1Identifier(int tagClass,
                          boolean constructed,
                          int tag)
    Constructs an ASN1Identifier using the classtype, form and tag.

    Parameters:
    tagClass - As defined above.
    constructed - Set to true if constructed and false if primitive.
    tag - The tag of this identifier

    ASN1Identifier

    public ASN1Identifier(java.io.InputStream in)
                   throws java.io.IOException
    Decode an ASN1Identifier directly from an InputStream and save the encoded length of the ASN1Identifier.

    Parameters:
    in - The input stream to decode from.

    ASN1Identifier

    public ASN1Identifier()
    Method Detail

    reset

    public final void reset(java.io.InputStream in)
                     throws java.io.IOException
    Decode an ASN1Identifier directly from an InputStream and save the encoded length of the ASN1Identifier, but reuse the object.

    Parameters:
    in - The input stream to decode from.
    Throws:
    java.io.IOException

    getASN1Class

    public final int getASN1Class()
    Returns the CLASS of this ASN1Identifier as an int value.

    See Also:
    UNIVERSAL, APPLICATION, CONTEXT, PRIVATE

    getConstructed

    public final boolean getConstructed()
    Return a boolean indicating if the constructed bit is set.

    Returns:
    true if constructed and false if primitive.

    getTag

    public final int getTag()
    Returns the TAG of this ASN1Identifier.


    getEncodedLength

    public final int getEncodedLength()
    Returns the encoded length of this ASN1Identifier.


    isUniversal

    public final boolean isUniversal()
    Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of UNIVERSAL.

    See Also:
    UNIVERSAL

    isApplication

    public final boolean isApplication()
    Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of APPLICATION.

    See Also:
    APPLICATION

    isContext

    public final boolean isContext()
    Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of CONTEXT-SPECIFIC.

    See Also:
    CONTEXT

    isPrivate

    public final boolean isPrivate()
    Returns a boolean value indicating whether or not this ASN1Identifier has a TAG CLASS of PRIVATE.

    See Also:
    PRIVATE

    clone

    public java.lang.Object clone()
    Creates a duplicate, not a true clone, of this object and returns a reference to the duplicate.


    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