com.sun.slamd.asn1
Class ASN1Null

java.lang.Object
  extended by com.sun.slamd.asn1.ASN1Element
      extended by com.sun.slamd.asn1.ASN1Null

public class ASN1Null
extends ASN1Element

This class defines an ASN.1 element that does not hold any value. It is generally used as a placeholder in cases where there needs to be an element to complete the encoding but there is no appropriate value to use in that case.

Author:
Neil A. Wilson

Field Summary
static ASN1Null NULL_ELEMENT
          A static version of a NULL element that can be used to prevent the need to create new instances whenever a null is needed with the default type.
 
Fields inherited from class com.sun.slamd.asn1.ASN1Element
ASN1_BOOLEAN_TYPE, ASN1_ENUMERATED_TYPE, ASN1_INTEGER_TYPE, ASN1_NULL_TYPE, ASN1_OCTET_STRING_TYPE, ASN1_SEQUENCE_TYPE, ASN1_SET_TYPE, EMPTY_BYTES
 
Constructor Summary
ASN1Null()
          Creates a new ASN.1 null element.
ASN1Null(byte type)
          Creates a new ASN.1 null element with the specified type.
 
Method Summary
static ASN1Null decodeAsNull(byte[] encodedValue)
          Decodes the provided byte array as an ASN.1 null element.
 byte[] encode()
          Encodes this ASN.1 element into a byte array.
 
Methods inherited from class com.sun.slamd.asn1.ASN1Element
byteArrayToInt, byteArrayToString, byteArrayToString, byteArrayToStringWithASCII, byteArrayToStringWithASCII, decode, decodeAsBoolean, decodeAsBoolean, decodeAsEnumerated, decodeAsEnumerated, decodeAsInteger, decodeAsInteger, decodeAsNull, decodeAsOctetString, decodeAsOctetString, decodeAsSequence, decodeAsSequence, decodeAsSet, decodeAsSet, decodeLength, encode, encodeLength, getBytes, getType, getTypeWithoutFlags, getValue, setType, setValue, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_ELEMENT

public static final ASN1Null NULL_ELEMENT
A static version of a NULL element that can be used to prevent the need to create new instances whenever a null is needed with the default type.

Constructor Detail

ASN1Null

public ASN1Null()
Creates a new ASN.1 null element.


ASN1Null

public ASN1Null(byte type)
Creates a new ASN.1 null element with the specified type.

Parameters:
type - The BER type to assign to this ASN.1 element.
Method Detail

encode

public byte[] encode()
Encodes this ASN.1 element into a byte array.

Overrides:
encode in class ASN1Element
Returns:
This ASN.1 element encoded as a byte array.

decodeAsNull

public static ASN1Null decodeAsNull(byte[] encodedValue)
                             throws ASN1Exception
Decodes the provided byte array as an ASN.1 null element.

Parameters:
encodedValue - The encoded ASN.1 element.
Returns:
The decoded ASN.1 null element.
Throws:
ASN1Exception - If the provided byte array cannot be decoded as an ASN.1 null element.