All Packages Class Hierarchy This Package Previous Next Index
Class iaik.asn1.ASN1Object
java.lang.Object
|
+----iaik.asn1.ASN1Object
- public abstract class ASN1Object
- extends Object
This abstract class defines the external interface for
ASN.1 values, both primitive and constructed.
The subclasses of this class are assumed to define the application
specific methods for accessing the data stored in the ASN.1 data
structure.
This class also implements a number of abstract factory methods
that create components of appropriate subclasses. In this way,
this class acts as a concrete factory an Abstract Factory pattern.
-
asnType
- The ASN.1 type of this ASN.1 object.
-
ASN1Object()
-
-
countComponents()
- Returns the number of components in this ASN1Object.
-
decode(int, int, DerDecodeInputStream)
- Decodes an ASN1Object by reading the encoding from a DerDecodeInputStream.
-
encode(DerEncodeOutputStream)
- Encodes this ASN1Object as a binary DER byte array and writes the result to
the DerEncodeOutputStream.
-
getAsnType()
- Returns the ASN.1 type of this ASN.1 object.
-
getComponentAt(int)
- Returns the ASN1Object at index if the ASN1Object is a SEQUENCE or a SET.
-
getValue()
- Returns the value of this ASN1Object.
-
indefiniteLength()
- Returns wether the length of this ASN1Object uses indefinite encoding.
-
isA(ASN)
- Tests if this object is an instance of given ASN.1 type.
-
isConstructed()
- Returns wether this ASN1Object is constructed or primitive.
-
setValue(Object)
- Sets the value of this ASN1Object.
-
toString()
- Returns a string that represents the contents of this ASN1Object.
asnType
protected ASN asnType
- The ASN.1 type of this ASN.1 object.
ASN1Object
public ASN1Object()
getAsnType
public ASN getAsnType()
- Returns the ASN.1 type of this ASN.1 object.
- Returns:
- the ASN.1 type of this ASN.1 object
indefiniteLength
public boolean indefiniteLength()
- Returns wether the length of this ASN1Object uses indefinite encoding.
- Returns:
- true, if indefinite length is used for encoding, false otherwise
isConstructed
public boolean isConstructed()
- Returns wether this ASN1Object is constructed or primitive.
- Returns:
- true, if constructed, false otherwise
isA
public boolean isA(ASN type)
- Tests if this object is an instance of given ASN.1 type.
getComponentAt
public ASN1Object getComponentAt(int index) throws CodingException
- Returns the ASN1Object at index if the ASN1Object is a SEQUENCE or a SET.
- Parameters:
- index - position in the sequence
- Returns:
- the ASN1Object at this position
- Throws: CodingException
- if this ASN1Object does not support getComponentAt(int) or
to indicate that the index is illegal
countComponents
public int countComponents() throws CodingException
- Returns the number of components in this ASN1Object.
Only useful with a SEQUENCE or a SET.
- Returns:
- the number of components in this ASN1Object
- Throws: CodingException
- if this ASN1Object does not support countComponents()
getValue
public abstract Object getValue()
- Returns the value of this ASN1Object. Implemented by the subclass.
setValue
public abstract void setValue(Object object)
- Sets the value of this ASN1Object. Implemented by the subclass.
encode
protected abstract void encode(DerEncodeOutputStream os)
- Encodes this ASN1Object as a binary DER byte array and writes the result to
the DerEncodeOutputStream. Implemented by the subclass.
decode
protected abstract void decode(int tag,
int length,
DerDecodeInputStream is) throws CodingException, IOException
- Decodes an ASN1Object by reading the encoding from a DerDecodeInputStream.
Implemented by the subclass.
- Parameters:
- tag - the tag read from is
- length - the already decoded length of this ASN1Object
- is - the InputStream with the encoded ASN1Object
- Throws: CodingException
- if the ASN1Object can not be decoded
- Throws: IOException
- if there is a problem with the InputStream
toString
public String toString()
- Returns a string that represents the contents of this ASN1Object. All
subclasses use this method for a common output form.
- Returns:
- the string representation
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index