|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.slamd.asn1.ASN1Element
public class ASN1Element
This class defines a generic ASN.1 element and a set of core methods for dealing with them. Subclasses may deal with more specific kinds of ASN.1 elements.
| Field Summary | |
|---|---|
static byte |
ASN1_BOOLEAN_TYPE
The standard ASN.1 type for boolean values. |
static byte |
ASN1_ENUMERATED_TYPE
The standard ASN.1 type for enumerated values. |
static byte |
ASN1_INTEGER_TYPE
The standard ASN.1 type for integer values. |
static byte |
ASN1_NULL_TYPE
The standard ASN.1 type for null values. |
static byte |
ASN1_OCTET_STRING_TYPE
The standard ASN.1 type for octet string values. |
static byte |
ASN1_SEQUENCE_TYPE
The standard ASN.1 type for sequence values. |
static byte |
ASN1_SET_TYPE
The standard ASN.1 type for set values. |
static byte[] |
EMPTY_BYTES
An empty byte array, used to prevent multiple allocations for empty arrays. |
| Constructor Summary | |
|---|---|
ASN1Element(byte type)
Creates a new ASN.1 element with the specified type and no value. |
|
ASN1Element(byte type,
byte[] value)
Creates a new ASN.1 element with the specified type and value. |
|
ASN1Element(byte type,
byte[] value,
byte[] encodedElement)
Creates a new ASN.1 element with the specified information. |
|
| Method Summary | |
|---|---|
protected static int |
byteArrayToInt(byte[] byteArray)
Converts the provided byte array into a Java int value. |
static java.lang.String |
byteArrayToString(byte[] byteArray)
Retrieves a string containing the hexadecimal digits contained in the provided byte array. |
static java.lang.String |
byteArrayToString(byte[] byteArray,
int indent)
Retrieves a string containing the hexadecimal digits contained in the provided byte array. |
static java.lang.String |
byteArrayToStringWithASCII(byte[] byteArray)
Retrieves a string representation of the provided byte array (including the ASCII equivalent). |
static java.lang.String |
byteArrayToStringWithASCII(byte[] byteArray,
int indent)
Retrieves a string representation of the provided byte array (including the ASCII equivalent) using the specified indent. |
static ASN1Element |
decode(byte[] encodedValue)
Decodes the provided byte array as a generic ASN.1 element. |
ASN1Boolean |
decodeAsBoolean()
Decodes this element as an ASN.1 Boolean element. |
static ASN1Boolean |
decodeAsBoolean(byte[] encodedValue)
Decodes the provided byte array as an ASN.1 Boolean element. |
ASN1Enumerated |
decodeAsEnumerated()
Decodes this element as an ASN.1 enumerated element. |
static ASN1Enumerated |
decodeAsEnumerated(byte[] encodedValue)
Decodes the provided byte array as an ASN.1 enumerated element. |
ASN1Integer |
decodeAsInteger()
Decodes this element as an ASN.1 integer element. |
static ASN1Integer |
decodeAsInteger(byte[] encodedValue)
Decodes the provided byte array as an ASN.1 integer element. |
ASN1Null |
decodeAsNull()
Decodes this element as an ASN.1 null element. |
static ASN1Null |
decodeAsNull(byte[] encodedValue)
Decodes the provided byte array as an ASN.1 null element. |
ASN1OctetString |
decodeAsOctetString()
Decodes this element as an ASN.1 octet string element. |
static ASN1OctetString |
decodeAsOctetString(byte[] encodedValue)
Decodes the provided byte array as an ASN.1 octet string element. |
ASN1Sequence |
decodeAsSequence()
Decodes this element as an ASN.1 sequence element. |
static ASN1Sequence |
decodeAsSequence(byte[] encodedValue)
Decodes the provided byte array as an ASN.1 sequence element. |
ASN1Set |
decodeAsSet()
Decodes this element as an ASN.1 set element. |
static ASN1Set |
decodeAsSet(byte[] encodedValue)
Decodes the provided byte array as an ASN.1 set element. |
static int |
decodeLength(byte[] encodedLength)
Decodes the provided byte array as a length. |
byte[] |
encode()
Encodes this ASN.1 element into a byte array. |
int |
encode(byte[] byteArray,
int startPos)
Encodes this ASN.1 element into the provided byte array at the indicated position. |
protected static byte[] |
encodeLength(int length)
Encodes the specified length as a byte array as it should appear in an ASN.1 element. |
static byte[] |
getBytes(java.lang.String stringValue)
Retrieves a byte array containing the binary representation of the provided string. |
byte |
getType()
Gets the type of this ASN.1 element. |
byte |
getTypeWithoutFlags()
Gets the type of this ASN.1 element without either of the class bits or the primitive/constructed bit set (i.e., the least significant five bits). |
byte[] |
getValue()
Gets the encoded value for this ASN.1 element. |
void |
setType(byte type)
Specifies the type for this ASN.1 element. |
void |
setValue(byte[] value)
Specifies the value for this ASN.1 element. |
java.lang.String |
toString()
Retrieves a string representation of this ASN.1 element. |
java.lang.String |
toString(int indent)
Retrieves a string representation of this ASN.1 element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte ASN1_BOOLEAN_TYPE
public static final byte ASN1_INTEGER_TYPE
public static final byte ASN1_OCTET_STRING_TYPE
public static final byte ASN1_NULL_TYPE
public static final byte ASN1_ENUMERATED_TYPE
public static final byte ASN1_SEQUENCE_TYPE
public static final byte ASN1_SET_TYPE
public static final byte[] EMPTY_BYTES
| Constructor Detail |
|---|
public ASN1Element(byte type)
type - The type of this ASN.1 element.
public ASN1Element(byte type,
byte[] value)
type - The type of this ASN.1 element.value - The encoded value for this ASN.1 element.
public ASN1Element(byte type,
byte[] value,
byte[] encodedElement)
type - The type of this ASN.1 element.value - The value for this ASN.1 element.encodedElement - The ASN.1 element encoded as a byte array.| Method Detail |
|---|
public byte getType()
public byte getTypeWithoutFlags()
public void setType(byte type)
type - The type for this ASN.1 element.public byte[] getValue()
public void setValue(byte[] value)
value - The value for this ASN.1 element.protected static byte[] encodeLength(int length)
length - The length value to be encoded.
public static int decodeLength(byte[] encodedLength)
throws ASN1Exception
encodedLength - The encoded value to decode as a length.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 length.public byte[] encode()
public int encode(byte[] byteArray,
int startPos)
byteArray - The byte array into which the value is to be encoded.startPos - The position in the byte array at which to start writing
the encoded value.
public static ASN1Element decode(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 element.
public ASN1Boolean decodeAsBoolean()
throws ASN1Exception
ASN1Exception - If this element cannot be decoded as an ASN.1
Boolean element.
public static ASN1Boolean decodeAsBoolean(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 Boolean element.
public ASN1Integer decodeAsInteger()
throws ASN1Exception
ASN1Exception - If this element cannot be decoded as an ASN.1
integer element.
public static ASN1Integer decodeAsInteger(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 integer element.
public ASN1OctetString decodeAsOctetString()
throws ASN1Exception
ASN1Exception - If this element cannot be decoded as an ASN.1
octet string element.
public static ASN1OctetString decodeAsOctetString(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 octet string element.
public ASN1Null decodeAsNull()
throws ASN1Exception
ASN1Exception - If this element cannot be decoded as an ASN.1 null
element.
public static ASN1Null decodeAsNull(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 null element.
public ASN1Enumerated decodeAsEnumerated()
throws ASN1Exception
ASN1Exception - If this element cannot be decoded as an ASN.1
enumerated element.
public static ASN1Enumerated decodeAsEnumerated(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 enumerated element.
public ASN1Sequence decodeAsSequence()
throws ASN1Exception
ASN1Exception - If this element cannot be decoded as an ASN.1
sequence element.
public static ASN1Sequence decodeAsSequence(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 sequence element.
public ASN1Set decodeAsSet()
throws ASN1Exception
ASN1Exception - If this element cannot be decoded as an ASN.1 set
element.
public static ASN1Set decodeAsSet(byte[] encodedValue)
throws ASN1Exception
encodedValue - The encoded ASN.1 element.
ASN1Exception - If the provided byte array cannot be decoded as an
ASN.1 set element.protected static int byteArrayToInt(byte[] byteArray)
byteArray - The byte array containing the encoded integer value.
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(int indent)
indent - The number of spaces to indent each line of the output.
public static java.lang.String byteArrayToString(byte[] byteArray)
byteArray - The byte array containing the information to be output.
public static java.lang.String byteArrayToString(byte[] byteArray,
int indent)
byteArray - The byte array containing the information to be output.indent - The number of spaces to indent each line of the output.
public static java.lang.String byteArrayToStringWithASCII(byte[] byteArray)
byteArray - The byte array to be displayed as a string.
public static java.lang.String byteArrayToStringWithASCII(byte[] byteArray,
int indent)
byteArray - The byte array to be displayed as a string.indent - The number of spaces to indent the output.
public static byte[] getBytes(java.lang.String stringValue)
String.getBytes() method.
stringValue - The string for which to retrieve the binary
representation.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||