| Modifier and Type | Class and Description |
|---|---|
static class |
BIT_STRING.Template
A class for decoding a
BIT_STRING from its BER encoding. |
| Constructor and Description |
|---|
BIT_STRING(java.util.BitSet bs,
int numBits)
Constructs a BIT_STRING from a BitSet.
|
BIT_STRING(byte[] bits,
int padCount) |
| Modifier and Type | Method and Description |
|---|---|
void |
encode(java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
its own base tag.
|
void |
encode(Tag implicitTag,
java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
an implicit tag.
|
byte[] |
getBits()
Returns the bits packed into an array of bytes, with padding
at the end.
|
int |
getPadCount()
Returns the number of padding bits at the end of the array.
|
boolean |
getRemoveTrailingZeroes()
Determines whether the DER-encoding of this bitstring will have
its trailing zeroes removed.
|
Tag |
getTag()
Returns the base tag for this type, not counting any tags
that may be imposed on it by its context.
|
static BIT_STRING.Template |
getTemplate() |
void |
setRemoveTrailingZeroes(boolean removeTrailingZeroes)
Determines whether the DER-encoding of this bitstring will have
its trailing zeroes removed.
|
java.util.BitSet |
toBitSet()
Copies this BIT STRING into a Java BitSet.
|
boolean[] |
toBooleanArray()
Copies this BIT STRING into a boolean array.
|
public BIT_STRING(byte[] bits,
int padCount)
throws java.lang.NumberFormatException
bits - The bits packed into an array of bytes, with padding
at the end. The array may be empty (but not null), in which case
padCount must be zero. The array is referenced,
not cloned.padCount - The number of padding bits at the end of the array.
Must be in the range [0,7].java.lang.NumberFormatException - If padCount is not in
the range [0,7], or bits is
empty and padCount is non-zero.public BIT_STRING(java.util.BitSet bs,
int numBits)
throws java.lang.NumberFormatException
bs - A BitSet.numBits - The number of bits to copy from the BitSet.
This is necessary because the size of a BitSet is always padded
up to a multiple of 64, but not all of these bits may
be significant.java.lang.NumberFormatException - If numBits is larger
than bs.size() or less than zero.public boolean getRemoveTrailingZeroes()
public void setRemoveTrailingZeroes(boolean removeTrailingZeroes)
public byte[] getBits()
padCount must be zero. The array is referenced,
not cloned.public java.util.BitSet toBitSet()
public boolean[] toBooleanArray()
true for 1 and false
for 0.public int getPadCount()
[0,7].public Tag getTag()
ASN1Valuepublic void encode(java.io.OutputStream ostream)
throws java.io.IOException
ASN1Valuepublic void encode(Tag implicitTag, java.io.OutputStream ostream) throws java.io.IOException
ASN1Valuepublic static BIT_STRING.Template getTemplate()