001package org.apache.commons.ssl.org.bouncycastle.asn1;
002
003import java.io.IOException;
004
005public class BERApplicationSpecificParser
006    implements ASN1ApplicationSpecificParser
007{
008    private final int tag;
009    private final ASN1StreamParser parser;
010
011    BERApplicationSpecificParser(int tag, ASN1StreamParser parser)
012    {
013        this.tag = tag;
014        this.parser = parser;
015    }
016
017    public ASN1Encodable readObject()
018        throws IOException
019    {
020        return parser.readObject();
021    }
022
023    public ASN1Primitive getLoadedObject()
024        throws IOException
025    {
026         return new BERApplicationSpecific(tag, parser.readVector());
027    }
028
029    public ASN1Primitive toASN1Primitive()
030    {
031        try
032        {
033            return getLoadedObject();
034        }
035        catch (IOException e)
036        {
037            throw new ASN1ParsingException(e.getMessage(), e);
038        }
039    }
040
041}