@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ASN1BitString extends ASN1Element
Constructor and Description |
---|
ASN1BitString(boolean... bits)
Creates a new ASN.1 bit string element with the default BER type and the
provided set of bits.
|
ASN1BitString(byte type,
boolean... bits)
Creates a new ASN.1 bit string element with the specified BER type and the
provided set of bits.
|
ASN1BitString(byte type,
java.lang.String stringRepresentation)
Creates a new ASN.1 bit string with the default BER type and a value
created from the provided string representation.
|
ASN1BitString(java.lang.String stringRepresentation)
Creates a new ASN.1 bit string with the default BER type and a value
created from the provided string representation.
|
Modifier and Type | Method and Description |
---|---|
static ASN1BitString |
decodeAsBitString(ASN1Element element)
Decodes the provided ASN.1 element as a bit string element.
|
static ASN1BitString |
decodeAsBitString(byte[] elementBytes)
Decodes the contents of the provided byte array as a bit string element.
|
boolean[] |
getBits()
Retrieves an array of
boolean values that correspond to the bits in
this bit string. |
static boolean[] |
getBitsForBytes(byte... bytes)
Retrieves an array of booleans that represent the bits in the provided
array of bytes.
|
byte[] |
getBytes()
Retrieves the bytes represented by the bits that comprise this bit string,
if the number of bits is a multiple of eight.
|
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, encodeTo, equals, equalsIgnoreType, getType, getTypeClass, getValue, getValueLength, hashCode, isConstructed, readFrom, readFrom, toString, writeTo
public ASN1BitString(@NotNull boolean... bits)
bits
- The bits to include in the bit string. Each boolean
value of true
represents a bit of one, and each
boolean
value of false
represents a bit of
zero. It must not be null
but may be empty.public ASN1BitString(byte type, @NotNull boolean... bits)
type
- The BER type to use for this element.bits
- The bits to include in the bit string. Each boolean
value of true
represents a bit of one, and each
boolean
value of false
represents a bit of
zero. It must not be null
but may be empty.public ASN1BitString(@NotNull java.lang.String stringRepresentation) throws ASN1Exception
stringRepresentation
- A string representation of the bit string to
create. It must not be null
, but may
be empty. It must be comprised only of the
characters '1' and '0'.ASN1Exception
- If the provided string does not represent a valid
bit string value.public ASN1BitString(byte type, @NotNull java.lang.String stringRepresentation) throws ASN1Exception
type
- The BER type to use for this element.stringRepresentation
- A string representation of the bit string to
create. It must not be null
, but may
be empty. It must be comprised only of the
characters '1' and '0'.ASN1Exception
- If the provided string does not represent a valid
bit string value.@NotNull public boolean[] getBits()
boolean
values that correspond to the bits in
this bit string. Each boolean
value of true
represents a
bit of one, and each boolean
value of false
represents a
bit of zero.boolean
values that correspond to the bits in
this bit string.@NotNull public byte[] getBytes() throws ASN1Exception
ASN1Exception
- If the number of bits in this bit string is not a
multiple of eight.@NotNull public static boolean[] getBitsForBytes(@NotNull byte... bytes)
bytes
- The bytes for which to retrieve the corresponding bits. It
must not be null
.@NotNull public static ASN1BitString decodeAsBitString(@NotNull byte[] elementBytes) throws ASN1Exception
elementBytes
- The byte array to decode as an ASN.1 bit string
element.ASN1Exception
- If the provided array cannot be decoded as a bit
string element.@NotNull public static ASN1BitString decodeAsBitString(@NotNull ASN1Element element) throws ASN1Exception
element
- The ASN.1 element to be decoded.ASN1Exception
- If the provided element cannot be decoded as a bit
string element.public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in class ASN1Element
buffer
- The buffer to which to append the information.