• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.bouncycastle.asn1;
2 
3 import java.io.IOException;
4 
5 /**
6  * Parser class for DL SETs.
7  *
8  * TODO The class is only publicly visible to support 'instanceof' checks; provide an alternative
9  */
10 public class DLSetParser
11     implements ASN1SetParser
12 {
13     private ASN1StreamParser _parser;
14 
DLSetParser(ASN1StreamParser parser)15     DLSetParser(ASN1StreamParser parser)
16     {
17         this._parser = parser;
18     }
19 
20     /**
21      * Return the next object in the SET.
22      *
23      * @return next object in SET.
24      * @throws IOException if there is an issue loading the object.
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 DLSet.
36      * @throws IOException if there is an issue loading the data.
37      */
getLoadedObject()38     public ASN1Primitive getLoadedObject()
39         throws IOException
40     {
41         return new DLSet(_parser.readVector());
42     }
43 
44     /**
45      * Return a DLSet representing this parser and its contents.
46      *
47      * @return a DLSet
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 }
61