com.sun.slamd.asn1
Class ASN1OctetString

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

public class ASN1OctetString
extends ASN1Element

This class defines an ASN.1 element that can hold an octet string value. An octet string is simply a set of bytes, and therefore any value can be encoded as an octet string, although other types may be more appropriate.

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
ASN1OctetString()
          Creates a new ASN.1 octet string with no value.
ASN1OctetString(byte type)
          Creates a new ASN.1 octet string with the specified type and no value.
ASN1OctetString(byte[] value)
          Creates a new ASN.1 octet string with the specified value.
ASN1OctetString(byte type, byte[] value)
          Creates a new ASN.1 octet string with the specified type and value.
ASN1OctetString(byte type, java.lang.String value)
          Creates a new ASN.1 octet string with the specified type and value.
ASN1OctetString(java.lang.String value)
          Creates a new ASN.1 octet string with the specified value.
 
Method Summary
static ASN1OctetString decodeAsOctetString(byte[] encodedValue)
          Decodes the provided byte array as an ASN.1 octet string element.
 java.lang.String getStringValue()
          Retrieves the value of this ASN.1 element as a Java string.
 
Methods inherited from class com.sun.slamd.asn1.ASN1Element
byteArrayToInt, byteArrayToString, byteArrayToString, byteArrayToStringWithASCII, byteArrayToStringWithASCII, decode, decodeAsBoolean, decodeAsBoolean, decodeAsEnumerated, decodeAsEnumerated, decodeAsInteger, decodeAsInteger, decodeAsNull, decodeAsNull, 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

ASN1OctetString

public ASN1OctetString()
Creates a new ASN.1 octet string with no value.


ASN1OctetString

public ASN1OctetString(byte type)
Creates a new ASN.1 octet string with the specified type and no value.

Parameters:
type - The type to use for this octet string element.

ASN1OctetString

public ASN1OctetString(java.lang.String value)
Creates a new ASN.1 octet string with the specified value.

Parameters:
value - The Java string value to encode into this octet string.

ASN1OctetString

public ASN1OctetString(byte[] value)
Creates a new ASN.1 octet string with the specified value.

Parameters:
value - The byte array to use as the value for this octet string.

ASN1OctetString

public ASN1OctetString(byte type,
                       java.lang.String value)
Creates a new ASN.1 octet string with the specified type and value.

Parameters:
type - The type to use for this octet string element.
value - The Java string value to encode into this octet string.

ASN1OctetString

public ASN1OctetString(byte type,
                       byte[] value)
Creates a new ASN.1 octet string with the specified type and value.

Parameters:
type - The type to use for this octet string element.
value - The byte array to use as the value for this octet string.
Method Detail

getStringValue

public java.lang.String getStringValue()
Retrieves the value of this ASN.1 element as a Java string.

Returns:
The value of this ASN.1 element as a Java string.

decodeAsOctetString

public static ASN1OctetString decodeAsOctetString(byte[] encodedValue)
                                           throws ASN1Exception
Decodes the provided byte array as an ASN.1 octet string element.

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