1 package org.bouncycastle.x509;
2 
3 import org.bouncycastle.x509.util.StreamParsingException;
4 
5 import java.io.InputStream;
6 import java.util.Collection;
7 
8 /**
9  * This abstract class defines the service provider interface (SPI) for
10  * X509StreamParser.
11  *
12  * @see org.bouncycastle.x509.X509StreamParser
13  *
14  */
15 public abstract class X509StreamParserSpi
16 {
17     /**
18      * Initializes this stream parser with the input stream.
19      *
20      * @param in The input stream.
21      */
engineInit(InputStream in)22     public abstract void engineInit(InputStream in);
23 
24     /**
25      * Returns the next X.509 object of the type of this SPI from the given
26      * input stream.
27      *
28      * @return the next X.509 object in the stream or <code>null</code> if the
29      *         end of the stream is reached.
30      * @exception StreamParsingException
31      *                if the object cannot be created from input stream.
32      */
engineRead()33     public abstract Object engineRead() throws StreamParsingException;
34 
35     /**
36      * Returns all X.509 objects of the type of this SPI from
37      * the given input stream.
38      *
39      * @return A collection of all X.509 objects in the input stream or
40      *         <code>null</code> if the end of the stream is reached.
41      * @exception StreamParsingException
42      *                if an object cannot be created from input stream.
43      */
engineReadAll()44     public abstract Collection engineReadAll() throws StreamParsingException;
45 }
46