• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.bouncycastle.asn1;
2 
3 import java.io.IOException;
4 
5 /**
6  * Parser for indefinite-length SETs.
7  *
8  * @deprecated Check for 'ASN1SetParser' instead
9  */
10 public class BERSetParser
11     implements ASN1SetParser
12 {
13     private ASN1StreamParser _parser;
14 
BERSetParser(ASN1StreamParser parser)15     BERSetParser(ASN1StreamParser parser)
16     {
17         this._parser = parser;
18     }
19 
20     /**
21      * Read the next object in the SET.
22      *
23      * @return the next object in the SET, null if there are no more.
24      * @throws IOException if there is an issue reading the underlying stream.
25      */
readObject()26     public ASN1Encodable readObject()
27         throws IOException
28     {
29         return _parser.readObject();
30     }
31 
32     /**
33      * Return an in-memory, encodable, representation of the SET.
34      *
35      * @return a BERSet.
36      * @throws IOException if there is an issue loading the data.
37      */
getLoadedObject()38     public ASN1Primitive getLoadedObject()
39         throws IOException
40     {
41         return parse(_parser);
42     }
43 
44     /**
45      * Return an BERSet representing this parser and its contents.
46      *
47      * @return an BERSet
48      */
toASN1Primitive()49     public ASN1Primitive toASN1Primitive()
50     {
51         try
52         {
53             return getLoadedObject();
54         }
55         catch (IOException e)
56         {
57             throw new ASN1ParsingException(e.getMessage(), e);
58         }
59     }
60 
parse(ASN1StreamParser sp)61     static BERSet parse(ASN1StreamParser sp) throws IOException
62     {
63         return new BERSet(sp.readVector());
64     }
65 }
66