@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ASN1OctetString extends ASN1Element implements ByteString
Constructor and Description |
---|
ASN1OctetString()
Creates a new ASN.1 octet string element with the default BER type and
no value.
|
ASN1OctetString(byte type)
Creates a new ASN.1 octet string element with the specified type and no
value.
|
ASN1OctetString(byte[] value)
Creates a new ASN.1 octet string element with the default BER type and the
provided value.
|
ASN1OctetString(byte[] value,
int offset,
int length)
Creates a new ASN.1 octet string element with the default BER type and the
provided value.
|
ASN1OctetString(byte type,
byte[] value)
Creates a new ASN.1 octet string element with the specified type and the
provided value.
|
ASN1OctetString(byte type,
byte[] value,
int offset,
int length)
Creates a new ASN.1 octet string element with the specified type and the
provided value.
|
ASN1OctetString(byte type,
java.lang.String value)
Creates a new ASN.1 octet string element with the specified type and the
provided value.
|
ASN1OctetString(java.lang.String value)
Creates a new ASN.1 octet string element with the default BER type and the
provided value.
|
Modifier and Type | Method and Description |
---|---|
void |
appendValueTo(ByteStringBuffer buffer)
Appends the value of this ASN.1 octet string to the provided buffer.
|
static ASN1OctetString |
decodeAsOctetString(ASN1Element element)
Decodes the provided ASN.1 element as an octet string element.
|
static ASN1OctetString |
decodeAsOctetString(byte[] elementBytes)
Decodes the contents of the provided byte array as an octet string element.
|
void |
encodeTo(ByteStringBuffer buffer)
Appends an encoded representation of this ASN.1 element to the provided
buffer.
|
byte[] |
getValue()
Retrieves the encoded value for this element.
|
int |
getValueLength()
Retrieves the number of bytes contained in the value.
|
java.lang.String |
stringValue()
Retrieves the string value for this element.
|
ASN1OctetString |
toASN1OctetString()
Converts this byte string to an ASN.1 octet string.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of the value for this ASN.1 element to the
provided buffer.
|
decode, decodeAsBigInteger, decodeAsBitString, decodeAsBoolean, decodeAsEnumerated, decodeAsGeneralizedTime, decodeAsIA5String, decodeAsInteger, decodeAsLong, decodeAsNull, decodeAsNumericString, decodeAsObjectIdentifier, decodeAsOctetString, decodeAsPrintableString, decodeAsSequence, decodeAsSet, decodeAsUTCTime, decodeAsUTF8String, encode, encodeLength, equals, equalsIgnoreType, getType, getTypeClass, hashCode, isConstructed, readFrom, readFrom, toString, writeTo
public ASN1OctetString()
public ASN1OctetString(byte type)
type
- The BER type to use for this element.public ASN1OctetString(@Nullable byte[] value)
value
- The value to use for this element.public ASN1OctetString(@NotNull byte[] value, int offset, int length)
value
- The byte array containing the value to use for this
element It must not be null
.offset
- The offset within the array at which the value begins. It
must be greater than or equal to zero and less than or
equal to the length of the array.length
- The length in bytes of the value. It must be greater than
or equal to zero, and it must not extend beyond the end of
the array.public ASN1OctetString(byte type, @Nullable byte[] value)
type
- The BER type to use for this element.value
- The value to use for this element.public ASN1OctetString(byte type, @NotNull byte[] value, int offset, int length)
type
- The BER type to use for this element.value
- The byte array containing the value to use for this
element. It must not be null
.offset
- The offset within the array at which the value begins. It
must be greater than or equal to zero and less than or
equal to the length of the array.length
- The length in bytes of the value. It must be greater than
or equal to zero, and it must not extend beyond the end of
the array.public ASN1OctetString(@Nullable java.lang.String value)
value
- The value to use for this element.public ASN1OctetString(byte type, @Nullable java.lang.String value)
type
- The BER type to use for this element.value
- The value to use for this element.public int getValueLength()
getValueLength
in class ASN1Element
@NotNull public byte[] getValue()
getValue
in interface ByteString
getValue
in class ASN1Element
public void encodeTo(@NotNull ByteStringBuffer buffer)
encodeTo
in class ASN1Element
buffer
- The buffer to which the encoded representation should be
appended.@NotNull public java.lang.String stringValue()
stringValue
in interface ByteString
@NotNull public static ASN1OctetString decodeAsOctetString(@NotNull byte[] elementBytes) throws ASN1Exception
elementBytes
- The byte array to decode as an ASN.1 octet string
element.ASN1Exception
- If the provided array cannot be decoded as an
octet string element.@NotNull public static ASN1OctetString decodeAsOctetString(@NotNull ASN1Element element)
element
- The ASN.1 element to be decoded.public void appendValueTo(@NotNull ByteStringBuffer buffer)
appendValueTo
in interface ByteString
buffer
- The buffer to which the value is to be appended.@NotNull public ASN1OctetString toASN1OctetString()
toASN1OctetString
in interface ByteString
public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in class ASN1Element
buffer
- The buffer to which to append the information.