Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.85
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.bouncycastle.asn1
Class ASN1BitString

    java.lang.Object
      org.bouncycastle.asn1.ASN1Object
          org.bouncycastle.asn1.ASN1Primitive
              org.bouncycastle.asn1.ASN1BitString

All Implemented Interfaces:
  ASN1BitStringParser, ASN1Encodable, ASN1String, Encodable, InMemoryRepresentable

Direct Known Subclasses:
  BERBitString, DERBitString, DLBitString

public abstract class ASN1BitString
extends ASN1Primitive
implements ASN1String, ASN1BitStringParser

Base class for BIT STRING objects

Method Summary
`java.io.InputStream` | `getBitStream()` Return an InputStream representing the contents of the BIT STRING.
`byte[]` | `getBytes()`
`protected static byte[]` | `getBytes(int bitString)` Deprecated. Will be removed
`int` | `getBytesLength()`
`static ASN1BitString` | `getInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
`static ASN1BitString` | `getInstance(java.lang.Object obj)`
`ASN1Primitive` | `getLoadedObject()` Get the in-memory representation of the ASN.1 object.
`byte[]` | `getOctets()` Return the octets contained in this BIT STRING, checking that this BIT STRING really does represent an octet aligned string.
`java.io.InputStream` | `getOctetStream()` Return an InputStream representing the contents of the BIT STRING, where the content is expected to be octet-aligned (this will be automatically checked during parsing).
`int` | `getPadBits()` Return the number of pad bits, if any, in the final byte, if any, read from `getBitStream()`.
`protected static int` | `getPadBits(int bitString)` Deprecated. Will be removed
`java.lang.String` | `getString()` Return a String representation of this BIT STRING
`static ASN1BitString` | `getTagged(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
`int` | `hashCode()`
`int` | `intValue()`
`boolean` | `isOctetAligned()`
`ASN1BitStringParser` | `parser()`
`java.lang.String` | `toString()`

Methods inherited from class org.bouncycastle.asn1.ASN1Primitive
`encodeTo, encodeTo, equals, equals, equals, fromByteArray, fromStream, toASN1Primitive`

Methods inherited from class org.bouncycastle.asn1.ASN1Object
`getEncoded, getEncoded, hasEncodedTagValue`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.bouncycastle.asn1.ASN1Encodable
`toASN1Primitive`

Method Detail

### getInstance

    public static ASN1BitString getInstance(java.lang.Object obj)

### getInstance

    public static ASN1BitString getInstance(ASN1TaggedObject taggedObject,
                                            boolean declaredExplicit)

### getTagged

    public static ASN1BitString getTagged(ASN1TaggedObject taggedObject,
                                          boolean declaredExplicit)

### getPadBits

    protected static int getPadBits(int bitString)

  Deprecated. Will be removed

  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)

  Deprecated. Will be removed

  Parameters:
    `bitString` - an int containing the BIT STRING
  Returns:
    the correct number of bytes for a bit string defined in a 32 bit constant

### getBitStream

    public java.io.InputStream getBitStream()
                                     throws java.io.IOException

  Description copied from interface: `ASN1BitStringParser`
  Return an InputStream representing the contents of the BIT STRING. The final byte, if any, may include pad bits. See `ASN1BitStringParser.getPadBits()`.

  Specified by:
    `getBitStream` in interface `ASN1BitStringParser`
  Returns:
    an InputStream with its source as the BIT STRING content.
  Throws:
    `java.io.IOException`

### getOctetStream

    public java.io.InputStream getOctetStream()
                                       throws java.io.IOException

  Description copied from interface: `ASN1BitStringParser`
  Return an InputStream representing the contents of the BIT STRING, where the content is expected to be octet-aligned (this will be automatically checked during parsing).

  Specified by:
    `getOctetStream` in interface `ASN1BitStringParser`
  Returns:
    an InputStream with its source as the BIT STRING content.
  Throws:
    `java.io.IOException`

### parser

    public ASN1BitStringParser parser()

### getString

    public java.lang.String getString()

  Return a String representation of this BIT STRING

  Specified by:
    `getString` in interface `ASN1String`
  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()

### getBytesLength

    public int getBytesLength()

### isOctetAligned

    public boolean isOctetAligned()

### getPadBits

    public int getPadBits()

  Description copied from interface: `ASN1BitStringParser`
  Return the number of pad bits, if any, in the final byte, if any, read from `ASN1BitStringParser.getBitStream()`. This number is in the range zero to seven. That number of the least significant bits of the final byte, if any, are not part of the contents and should be ignored. NOTE: Must be called AFTER the stream has been fully processed. (Does not need to be called if `ASN1BitStringParser.getOctetStream()` was used instead of `ASN1BitStringParser.getBitStream()`).

  Specified by:
    `getPadBits` in interface `ASN1BitStringParser`
  Returns:
    the number of pad bits. In the range zero to seven.

### toString

    public java.lang.String toString()

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in class `ASN1Primitive`

### getLoadedObject

    public ASN1Primitive getLoadedObject()

  Description copied from interface: `InMemoryRepresentable`
  Get the in-memory representation of the ASN.1 object.

  Specified by:
    `getLoadedObject` in interface `InMemoryRepresentable`
  Returns:
    an ASN1Primitive representing the loaded object.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.85
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD