FileDocCategorySizeDatePackage
DERApplicationSpecific.javaAPI DocAndroid 1.5 API2434Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1

DERApplicationSpecific

public class DERApplicationSpecific extends DERObject
Base class for an application specific object

Fields Summary
private int
tag
private byte[]
octets
Constructors Summary
public DERApplicationSpecific(int tag, byte[] octets)

        this.tag = tag;
        this.octets = octets;
    
public DERApplicationSpecific(int tag, DEREncodable object)

        this.tag = tag | DERTags.CONSTRUCTED;
        
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DEROutputStream dos = new DEROutputStream(baos);
        
        dos.writeObject(object);
        
        this.octets = baos.toByteArray();
    
Methods Summary
voidencode(DEROutputStream out)

        out.writeEncoded(DERTags.APPLICATION | tag, octets);
    
public booleanequals(java.lang.Object o)

        if ((o == null) || !(o instanceof DERApplicationSpecific))
        {
            return false;
        }
        
        DERApplicationSpecific other = (DERApplicationSpecific)o;
        
        if (tag != other.tag)
        {
            return false;
        }
        
        if (octets.length != other.octets.length)
        {
            return false;
        }
        
        for (int i = 0; i < octets.length; i++) 
        {
            if (octets[i] != other.octets[i])
            {
                return false;
            }
        }
        
        return true;
    
public intgetApplicationTag()

        return tag & 0x1F;
    
public byte[]getContents()

        return octets;
    
public DERObjectgetObject()

        return new ASN1InputStream(getContents()).readObject();
    
public inthashCode()

        byte[]  b = this.getContents();
        int     value = 0;

        for (int i = 0; i != b.length; i++)
        {
            value ^= (b[i] & 0xff) << (i % 4);
        }

        return value ^ this.getApplicationTag();
    
public booleanisConstructed()

        return (tag & DERTags.CONSTRUCTED) != 0;