ASN1Boolean (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.asn1

## Class ASN1Boolean

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.ASN1Primitive
    - - org.bouncycastle.asn1.ASN1Boolean

- All Implemented Interfaces:
    ASN1Encodable, Encodable
  Direct Known Subclasses:
    DERBoolean

      public class ASN1Boolean
      extends ASN1Primitive

  Public facade of ASN.1 Boolean data.

  Use following to place a new instance of ASN.1 Boolean in your dataset:

  - ASN1Boolean.TRUE literal
  - ASN1Boolean.FALSE literal
  - `ASN1Boolean.getInstance(boolean)`
  - `ASN1Boolean.getInstance(int)`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ASN1Boolean` | `FALSE`
    `static ASN1Boolean` | `TRUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ASN1Boolean(boolean value)` Deprecated. use getInstance(boolean) method.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `asn1Equals(ASN1Primitive o)`
    `static ASN1Boolean` | `getInstance(ASN1TaggedObject obj, boolean explicit)` return a Boolean from a tagged object.
    `static ASN1Boolean` | `getInstance(boolean value)` return an ASN1Boolean from the passed in boolean.
    `static ASN1Boolean` | `getInstance(int value)` return an ASN1Boolean from the passed in value.
    `static ASN1Boolean` | `getInstance(java.lang.Object obj)` return a boolean from the passed in object.
    `int` | `hashCode()`
    `boolean` | `isTrue()`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Primitive

      `equals, fromByteArray, toASN1Primitive`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `getEncoded, getEncoded, hasEncodedTagValue, toASN1Object`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### FALSE

          public static final ASN1Boolean FALSE

    - #### TRUE

          public static final ASN1Boolean TRUE

  - ### Constructor Detail

    - #### ASN1Boolean

          public ASN1Boolean(boolean value)

      Deprecated. use getInstance(boolean) method.
      Parameters:
        `value` - true or false.

  - ### Method Detail

    - #### getInstance

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

      return a boolean from the passed in object.
      Parameters:
        `obj` - an ASN1Boolean or an object that can be converted into one.
      Returns:
        an ASN1Boolean instance.
      Throws:
        `java.lang.IllegalArgumentException` - if the object cannot be converted.

    - #### getInstance

          public static ASN1Boolean getInstance(boolean value)

      return an ASN1Boolean from the passed in boolean.
      Returns:
        an ASN1Boolean instance.

    - #### getInstance

          public static ASN1Boolean getInstance(int value)

      return an ASN1Boolean from the passed in value.
      Returns:
        an ASN1Boolean instance.

    - #### getInstance

          public static ASN1Boolean getInstance(ASN1TaggedObject obj,
                                boolean explicit)

      return a Boolean from a tagged object.
      Parameters:
        `obj` - the tagged object holding the object we want
        `explicit` - true if the object is meant to be explicitly tagged false otherwise.
      Returns:
        an ASN1Boolean instance.
      Throws:
        `java.lang.IllegalArgumentException` - if the tagged object cannot be converted.

    - #### isTrue

          public boolean isTrue()

    - #### asn1Equals

          protected boolean asn1Equals(ASN1Primitive o)

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `ASN1Primitive`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`