Logo Search packages:      
Sourcecode: bouncycastle version File versions  Download package

ASN1ObjectParser.java

package org.bouncycastle.asn1;

import java.io.InputStream;
import java.io.IOException;

public class ASN1ObjectParser
{
    private int              _baseTag;
    private int              _tagNumber;

    private ASN1StreamParser _aIn;

    protected ASN1ObjectParser(
        int         baseTag,
        int         tagNumber,
        InputStream contentStream)
    {
        _baseTag = baseTag;
        _tagNumber = tagNumber;
        _aIn = new ASN1StreamParser(contentStream);
    }

    /**
     * Return the tag number for this object.
     *
     * @return the tag number.
     */
    int getTagNumber()
    {
        return _tagNumber;
    }

    int getBaseTag()
    {
        return _baseTag;
    }

    DEREncodable readObject()
        throws IOException
    {
        return _aIn.readObject();
    }

    ASN1EncodableVector readVector()
        throws IllegalStateException
    {
        ASN1EncodableVector v = new ASN1EncodableVector();
        DEREncodable obj;

        try
        {
            while ((obj = readObject()) != null)
            {
                v.add(obj.getDERObject());
            }
        }
        catch (IOException e)
        {
            throw new IllegalStateException(e.getMessage());
        }

        return v;
    }
}

Generated by  Doxygen 1.6.0   Back to index