Package org.bouncycastle.asn1
Class ASN1BitString
java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.ASN1Primitive
org.bouncycastle.asn1.ASN1BitString
- All Implemented Interfaces:
ASN1Encodable
,ASN1String
,Encodable
- Direct Known Subclasses:
DERBitString
,DLBitString
Base class for BIT STRING objects
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionASN1BitString
(byte[] data, int padBits) Base constructor.protected
ASN1BitString
(byte data, int padBits) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getBytes()
protected static byte[]
getBytes
(int bitString) byte[]
Return the octets contained in this BIT STRING, checking that this BIT STRING really does represent an octet aligned string.int
protected static int
getPadBits
(int bitString) Return a String representation of this BIT STRINGint
hashCode()
int
intValue()
toString()
Methods inherited from class org.bouncycastle.asn1.ASN1Primitive
encodeTo, encodeTo, equals, equals, equals, fromByteArray, toASN1Primitive
Methods inherited from class org.bouncycastle.asn1.ASN1Object
getEncoded, getEncoded, hasEncodedTagValue
-
Field Details
-
data
protected final byte[] data -
padBits
protected final int padBits
-
-
Constructor Details
-
ASN1BitString
protected ASN1BitString(byte data, int padBits) -
ASN1BitString
public ASN1BitString(byte[] data, int padBits) Base constructor.- Parameters:
data
- the octets making up the bit string.padBits
- the number of extra bits at the end of the string.
-
-
Method Details
-
getPadBits
protected static int getPadBits(int bitString) - Parameters:
bitString
- an int containing the BIT STRING- Returns:
- the correct number of pad bits for a bit string defined in a 32 bit constant
-
getBytes
protected static byte[] getBytes(int bitString) - Parameters:
bitString
- an int containing the BIT STRING- Returns:
- the correct number of bytes for a bit string defined in a 32 bit constant
-
getString
Return a String representation of this BIT STRING- Specified by:
getString
in interfaceASN1String
- Returns:
- a String representation.
-
intValue
public int intValue()- Returns:
- the value of the bit string as an int (truncating if necessary)
-
getOctets
public byte[] getOctets()Return the octets contained in this BIT STRING, checking that this BIT STRING really does represent an octet aligned string. Only use this method when the standard you are following dictates that the BIT STRING will be octet aligned.- Returns:
- a copy of the octet aligned data.
-
getBytes
public byte[] getBytes() -
getPadBits
public int getPadBits() -
toString
-
hashCode
public int hashCode()- Specified by:
hashCode
in classASN1Primitive
-
getLoadedObject
-