com.sun.slamd.asn1
Class ASN1Enumerated

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

public class ASN1Enumerated
extends ASN1Element

This class defines an ASN.1 element that can hold an enumerated value. It behaves in all respects like an integer, with the exception that each value of an enumerated element has a particular meaning (application-specific or context-specific) associated with it.

Author:
Neil A. Wilson

Field Summary
 
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
ASN1Enumerated(byte type, int intValue)
          Creates a new ASN.1 enumerated element with the specified type and value.
ASN1Enumerated(int intValue)
          Creates a new ASN.1 enumerated element with the specified value.
 
Method Summary
static ASN1Enumerated decodeAsEnumerated(byte[] encodedValue)
          Decodes the provided byte array as an ASN.1 enumerated element.
static byte[] encodeIntValue(int intValue)
          Encodes the provided int value in the appropriate manner for an ASN.1 enumerated value.
 int getIntValue()
          Retrieves the Java int value that corresponds to the value of this ASN.1 enumerated element.
 
Methods inherited from class com.sun.slamd.asn1.ASN1Element
byteArrayToInt, byteArrayToString, byteArrayToString, byteArrayToStringWithASCII, byteArrayToStringWithASCII, decode, decodeAsBoolean, decodeAsBoolean, decodeAsEnumerated, decodeAsInteger, decodeAsInteger, decodeAsNull, decodeAsNull, decodeAsOctetString, decodeAsOctetString, decodeAsSequence, decodeAsSequence, decodeAsSet, decodeAsSet, decodeLength, encode, 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
 

Constructor Detail

ASN1Enumerated

public ASN1Enumerated(int intValue)
Creates a new ASN.1 enumerated element with the specified value.

Parameters:
intValue - The Java int value to use in creating the ASN.1 enumerated element.

ASN1Enumerated

public ASN1Enumerated(byte type,
                      int intValue)
Creates a new ASN.1 enumerated element with the specified type and value.

Parameters:
type - The type to use for this enumerated value.
intValue - The Java int value to use in creating the ASN.1 enumerated value.
Method Detail

encodeIntValue

public static byte[] encodeIntValue(int intValue)
Encodes the provided int value in the appropriate manner for an ASN.1 enumerated value.

Parameters:
intValue - The Java int value to encode as an ASN.1 enumerated value.
Returns:
A byte array that contains the encoded int value.

getIntValue

public int getIntValue()
Retrieves the Java int value that corresponds to the value of this ASN.1 enumerated element.

Returns:
The Java int value that corresponds to the value of this ASN.1 enumerated element.

decodeAsEnumerated

public static ASN1Enumerated decodeAsEnumerated(byte[] encodedValue)
                                         throws ASN1Exception
Decodes the provided byte array as an ASN.1 enumerated element.

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