FileDocCategorySizeDatePackage
DERBoolean.javaAPI DocAndroid 1.5 API3032Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1

DERBoolean

public class DERBoolean extends DERObject

Fields Summary
private final byte
value
public static final DERBoolean
FALSE
public static final DERBoolean
TRUE
Constructors Summary
private DERBoolean(boolean value)

        this.value = (value) ? (byte)0xff : (byte)0;
    
Methods Summary
voidencode(DEROutputStream out)

        byte[]  bytes = new byte[1];

        bytes[0] = value;

        out.writeEncoded(BOOLEAN, bytes);
    
public booleanequals(java.lang.Object o)

        if ((o == null) || !(o instanceof DERBoolean))
        {
            return false;
        }

        return (value == ((DERBoolean)o).value);
    
public static org.bouncycastle.asn1.DERBooleangetInstance(java.lang.Object obj)
return a boolean from the passed in object.

exception
IllegalArgumentException if the object cannot be converted.


                         
       
          
    
        if (obj == null || obj instanceof DERBoolean)
        {
            return (DERBoolean)obj;
        }

        if (obj instanceof ASN1OctetString)
        {
            // BEGIN android-changed
            return getInstance(((ASN1OctetString)obj).getOctets());
            // END android-changed
        }

        if (obj instanceof ASN1TaggedObject)
        {
            return getInstance(((ASN1TaggedObject)obj).getObject());
        }

        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
    
public static org.bouncycastle.asn1.DERBooleangetInstance(boolean value)
return a DERBoolean from the passed in boolean.

        return (value ? TRUE : FALSE);
    
public static org.bouncycastle.asn1.DERBooleangetInstance(byte[] octets)
return a DERBoolean from the passed in array.

        return (octets[0] != 0) ? TRUE : FALSE;
    
public static org.bouncycastle.asn1.DERBooleangetInstance(ASN1TaggedObject obj, boolean explicit)
return a Boolean from a tagged object.

param
obj the tagged object holding the object we want
param
explicit true if the object is meant to be explicitly tagged false otherwise.
exception
IllegalArgumentException if the tagged object cannot be converted.

        return getInstance(obj.getObject());
    
public inthashCode()

        return value;
    
public booleanisTrue()

        return (value != 0);
    
public java.lang.StringtoString()

      return (value != 0) ? "TRUE" : "FALSE";