FileDocCategorySizeDatePackage
DERBoolean.javaAPI DocAzureus 3.0.3.42374Tue Jun 08 05:12:56 BST 2004org.bouncycastle.asn1

DERBoolean

public class DERBoolean extends DERObject

Fields Summary
byte
value
public static final DERBoolean
FALSE
public static final DERBoolean
TRUE
Constructors Summary
public DERBoolean(byte[] value)

        this.value = value[0];
    
public 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)
        {
            return new DERBoolean(((ASN1OctetString)obj).getOctets());
        }

        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(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 booleanisTrue()

        return (value != 0);