BERApplicationSpecificParser.java revision e6bf3e8dfa2804891a82075cb469b736321b4827
1package org.bouncycastle.asn1;
2
3import java.io.IOException;
4
5public class BERApplicationSpecificParser
6    implements ASN1ApplicationSpecificParser
7{
8    private final int tag;
9    private final ASN1StreamParser parser;
10
11    BERApplicationSpecificParser(int tag, ASN1StreamParser parser)
12    {
13        this.tag = tag;
14        this.parser = parser;
15    }
16
17    public ASN1Encodable readObject()
18        throws IOException
19    {
20        return parser.readObject();
21    }
22
23    public ASN1Primitive getLoadedObject()
24        throws IOException
25    {
26         return new BERApplicationSpecific(tag, parser.readVector());
27    }
28
29    public ASN1Primitive toASN1Primitive()
30    {
31        try
32        {
33            return getLoadedObject();
34        }
35        catch (IOException e)
36        {
37            throw new ASN1ParsingException(e.getMessage(), e);
38        }
39    }
40
41}
42