iaik.asn1
Class NULL

java.lang.Object
  |
  +--iaik.asn1.ASN1Object
        |
        +--iaik.asn1.NULL
All Implemented Interfaces:
Cloneable

public class NULL
extends ASN1Object

This class implements the native ASN.1 type "NULL". NULL is a simple non-string ASN.1 type identified by the UNIVERSAL TAG number 5.

An ASN.1 NULL object can represent only one value, null. It may be used in situations where only the presence of a type is important, but no concrete value.

The DER encoding of the NULL type is primitive and only consists of identifier (05) and length octets (00); no content octets are necessary:

  id length
  05   00
 
Consequently, no value can be specified when creating a new NULL object; and when asking for a value by means of the getValue() method, null is returned.

Version:
File Revision 17
See Also:
ASN1Object, ASN

Fields inherited from class iaik.asn1.ASN1Object
asnType, constructed, encode_listener, indefinite_length, isStringType, stream_mode
 
Constructor Summary
NULL()
          Allocates a NULL object.
 
Method Summary
protected  void decode(int length, InputStream is)
          Decodes a NULL value from the given InputStream.
protected  void encode(OutputStream os)
          DER encodes this NULL ASN1Object and writes the result to the given output stream.
 Object getValue()
          Returns null.
 void setValue(Object object)
          Does nothing.
 String toString()
          Returns a string that represents the contents of this NULL ASN1Object.
 
Methods inherited from class iaik.asn1.ASN1Object
addComponent, addEncodeListener, clone, countComponents, encodeObject, getAsnType, getComponentAt, indefiniteLength, isA, isConstructed, isStringType, setIndefiniteLength
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NULL

public NULL()
Allocates a NULL object.
Method Detail

getValue

public Object getValue()
Returns null.
Overrides:
getValue in class ASN1Object
Returns:
the value of this NULL object which always is null

setValue

public void setValue(Object object)
Does nothing. Only implements abstract method from ASN1Object.
Overrides:
setValue in class ASN1Object
Parameters:
object - an Object which is used for nothing

encode

protected void encode(OutputStream os)
DER encodes this NULL ASN1Object and writes the result to the given output stream. Since a NULL object does not have a value, this method actually does nothing.
Overrides:
encode in class ASN1Object
Parameters:
os - the output stream to which to write the data

decode

protected void decode(int length,
                      InputStream is)
Decodes a NULL value from the given InputStream. Since a NULL object does not have a value, this method actually does nothing.
Overrides:
decode in class ASN1Object
Parameters:
length - the length of the ASN1Object which shall be decoded
is - the input stream from which the der encoded data is read in

toString

public String toString()
Returns a string that represents the contents of this NULL ASN1Object.
Overrides:
toString in class ASN1Object
Returns:
the string representation
See Also:
ASN1Object.toString()

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK