public class ASN1BitString extends java.lang.Object implements ASN1TaggedObject
The input may be any valid BER encoding of an ASN.1 bit string. The output is always a DER encoding.
| Constructor and Description |
|---|
ASN1BitString() |
ASN1BitString(java.math.BigInteger v)
Creates a new bit string from the given integer value.
|
ASN1BitString(byte[] value) |
ASN1BitString(byte[] value, int unused) |
ASN1BitString(java.io.InputStream is) |
ASN1BitString(int nBits)
Creates a new ASN.1 bit string of the specified number of bits.
|
| Modifier and Type | Method and Description |
|---|---|
int |
bitLength() |
void |
clearBit(int n)
Clears the specified bit.
|
ASN1Header |
getHeader() |
int |
getUnused() |
byte[] |
getValue() |
void |
input(java.io.InputStream is)
Inputs this object from the specified input stream.
|
static byte[] |
inputValue(java.io.InputStream is) |
int |
intValue() |
int |
length()
Length of this object's encoding.
|
void |
output(java.io.OutputStream os)
Outputs this object to the specified output stream.
|
static void |
outputValue(java.io.OutputStream os, byte[] value) |
static void |
outputValueWithTag(java.io.OutputStream os, byte[] value, int tag) |
void |
setBit(int n)
Sets the specified bit.
|
boolean |
testBit(int n)
Tests the specified bit.
|
java.lang.String |
toString() |
public ASN1BitString()
public ASN1BitString(byte[] value)
public ASN1BitString(byte[] value,
int unused)
public ASN1BitString(int nBits)
public ASN1BitString(java.math.BigInteger v)
The new bit string is obtained from the binary expansion of n, most significant bit first, not including the sign bit.
public ASN1BitString(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic ASN1Header getHeader()
getHeader in interface ASN1TaggedObjectpublic byte[] getValue()
public int intValue()
public int getUnused()
public int bitLength()
public boolean testBit(int n)
java.lang.ArithmeticException - If the bit index is out of boundspublic void setBit(int n)
java.lang.ArithmeticException - If the bit index is out of boundspublic void clearBit(int n)
java.lang.ArithmeticException - If the bit index is out of boundspublic java.lang.String toString()
toString in class java.lang.Object
public void input(java.io.InputStream is)
throws java.io.IOException
Streamableinput in interface Streamablejava.io.IOException
public static byte[] inputValue(java.io.InputStream is)
throws java.io.IOException
java.io.IOException
public void output(java.io.OutputStream os)
throws java.io.IOException
Streamableoutput in interface Streamablejava.io.IOExceptionpublic int length()
Streamablelength in interface Streamable
public static void outputValue(java.io.OutputStream os,
byte[] value)
throws java.io.IOException
java.io.IOException
public static void outputValueWithTag(java.io.OutputStream os,
byte[] value,
int tag)
throws java.io.IOException
java.io.IOException