All LDAP Classes
Internal LDAP Classes

com.novell.ldap.asn1
Class ASN1Identifier

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

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.
    private  boolean constructed
               
    static int CONTEXT
              Context-specific tag class.
    private  int encodedLength
               
    static int PRIVATE
              Private-use tag class.
    private  int tag
               
    private  int tagClass
               
    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.
    private  int decodeTagNumber(java.io.InputStream in)
              In the case that we have a tag number that is greater than 30, we need to decode a multiple octet tag number.
     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.
    private  void readObject(java.io.ObjectInputStream objectIStrm)
              Reads the serialized object from the underlying input stream.
     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.
    private  void writeObject(java.io.ObjectOutputStream objectOStrm)
              Writes the object state to a stream in standard Default Binary format This function wraps ObjectOutputStream' s defaultWriteObject() to write the non-static and non-transient fields of the current class to the stream
     
    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

    tagClass

    private int tagClass

    constructed

    private boolean constructed

    tag

    private int tag

    encodedLength

    private int encodedLength
    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.
    Throws:
    java.io.IOException

    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

    decodeTagNumber

    private int decodeTagNumber(java.io.InputStream in)
                         throws java.io.IOException
    In the case that we have a tag number that is greater than 30, we need to decode a multiple octet tag number.

    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.

    Overrides:
    clone in class java.lang.Object

    writeObject

    private void writeObject(java.io.ObjectOutputStream objectOStrm)
                      throws java.io.IOException
    Writes the object state to a stream in standard Default Binary format This function wraps ObjectOutputStream' s defaultWriteObject() to write the non-static and non-transient fields of the current class to the stream

    Parameters:
    objectOStrm - The OutputSteam where the Object need to be written
    Throws:
    java.io.IOException

    readObject

    private void readObject(java.io.ObjectInputStream objectIStrm)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
    Reads the serialized object from the underlying input stream. This function wraps ObjectInputStream's defaultReadObject() function

    Parameters:
    objectIStrm - InputStream used to recover those objects previously serialized.
    Throws:
    java.io.IOException
    java.lang.ClassNotFoundException

    All LDAP Classes
    Internal LDAP Classes

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