com.sun.slamd.asn1
Class ASN1Boolean

java.lang.Object
  extended bycom.sun.slamd.asn1.ASN1Element
      extended bycom.sun.slamd.asn1.ASN1Boolean

public class ASN1Boolean
extends ASN1Element

This class defines an ASN.1 element that can hold a Boolean value (for storing values of either true or false).


Field Summary
static byte BOOLEAN_FALSE
          The value that will be used for Boolean values of false.
static byte[] BOOLEAN_FALSE_ARRAY
          The byte array that will be used as the "false" value for Boolean elements.
static byte BOOLEAN_TRUE
          The value that will be used for Boolean values of true.
static byte[] BOOLEAN_TRUE_ARRAY
          The byte array that will be used as the "true" value for Boolean elements.
static ASN1Boolean FALSE_ELEMENT
          The ASN.1 Boolean element with a value of "false".
static ASN1Boolean TRUE_ELEMENT
          The ASN.1 Boolean element with a value of "true".
 
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
ASN1Boolean(boolean booleanValue)
          Creates a new ASN.1 Boolean element with the specified value.
ASN1Boolean(byte type, boolean booleanValue)
          Creates a new ASN.1 Boolean element with the specified type and value.
 
Method Summary
static ASN1Boolean decodeAsBoolean(byte[] encodedValue)
          Decodes the provided byte array as an ASN.1 Boolean element.
 byte[] encode()
          Encodes this ASN.1 element into a byte array.
 boolean getBooleanValue()
          Retrieves the Java boolean value associated with this ASN.1 Boolean element.
 
Methods inherited from class com.sun.slamd.asn1.ASN1Element
byteArrayToInt, byteArrayToString, byteArrayToString, decode, decodeAsBoolean, decodeAsEnumerated, decodeAsEnumerated, decodeAsInteger, decodeAsInteger, decodeAsNull, 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

BOOLEAN_FALSE

public static final byte BOOLEAN_FALSE
The value that will be used for Boolean values of false. A Boolean value will only be considered false if it is equal to this value.

See Also:
Constant Field Values

BOOLEAN_FALSE_ARRAY

public static final byte[] BOOLEAN_FALSE_ARRAY
The byte array that will be used as the "false" value for Boolean elements.


BOOLEAN_TRUE

public static final byte BOOLEAN_TRUE
The value that will be used for Boolean values of true. A Boolean value will be considered true as long is it does not equal the value for false, but this specific value will be used for encoding true values.

See Also:
Constant Field Values

BOOLEAN_TRUE_ARRAY

public static final byte[] BOOLEAN_TRUE_ARRAY
The byte array that will be used as the "true" value for Boolean elements.


FALSE_ELEMENT

public static final ASN1Boolean FALSE_ELEMENT
The ASN.1 Boolean element with a value of "false".


TRUE_ELEMENT

public static final ASN1Boolean TRUE_ELEMENT
The ASN.1 Boolean element with a value of "true".

Constructor Detail

ASN1Boolean

public ASN1Boolean(boolean booleanValue)
Creates a new ASN.1 Boolean element with the specified value.

Parameters:
booleanValue - The Java boolean value to use to create this ASN.1 Boolean element.

ASN1Boolean

public ASN1Boolean(byte type,
                   boolean booleanValue)
Creates a new ASN.1 Boolean element with the specified type and value.

Parameters:
type - The type to use for this ASN.1 Boolean element.
booleanValue - The Java boolean value to use to create this ASN.1 Boolean element.
Method Detail

getBooleanValue

public boolean getBooleanValue()
Retrieves the Java boolean value associated with this ASN.1 Boolean element.

Returns:
The Java boolean value associated with this ASN.1 Boolean element.

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.

decodeAsBoolean

public static ASN1Boolean decodeAsBoolean(byte[] encodedValue)
                                   throws ASN1Exception
Decodes the provided byte array as an ASN.1 Boolean element.

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