org.bouncycastle.x509
Class X509StreamParser

java.lang.Object
  extended by org.bouncycastle.x509.X509StreamParser
All Implemented Interfaces:
StreamParser

public class X509StreamParser
extends java.lang.Object
implements StreamParser

This class allows access to different implementations for reading X.509 objects from streams.

A X509StreamParser is used to read a collection of objects or a single object of a certain X.509 object structure. E.g. one X509StreamParser can read certificates, another one CRLs, certification paths, attribute certificates and so on. The kind of object structure is specified with the algorithm parameter to the getInstance methods.

Implementations must implement the X509StreamParserSpi.


Field Summary
private  java.security.Provider _provider
           
private  X509StreamParserSpi _spi
           
 
Constructor Summary
private X509StreamParser(java.security.Provider provider, X509StreamParserSpi spi)
           
 
Method Summary
private static X509StreamParser createParser(X509Util.Implementation impl)
           
static X509StreamParser getInstance(java.lang.String type)
          Generates a StreamParser object that implements the specified type.
static X509StreamParser getInstance(java.lang.String type, java.security.Provider provider)
          Generates a X509StreamParser object for the specified type from the specified provider.
static X509StreamParser getInstance(java.lang.String type, java.lang.String provider)
          Generates a X509StreamParser object for the specified type from the specified provider.
 java.security.Provider getProvider()
           
 void init(byte[] data)
           
 void init(java.io.InputStream stream)
           
 java.lang.Object read()
           
 java.util.Collection readAll()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_provider

private java.security.Provider _provider

_spi

private X509StreamParserSpi _spi
Constructor Detail

X509StreamParser

private X509StreamParser(java.security.Provider provider,
                         X509StreamParserSpi spi)
Method Detail

getInstance

public static X509StreamParser getInstance(java.lang.String type)
                                    throws NoSuchParserException
Generates a StreamParser object that implements the specified type. If the default provider package provides an implementation of the requested type, an instance of StreamParser containing that implementation is returned. If the type is not available in the default package, other packages are searched.

Parameters:
type - The name of the requested X.509 object type.
Returns:
a StreamParser object for the specified type.
Throws:
NoSuchParserException - if the requested type is not available in the default provider package or any of the other provider packages that were searched.

getInstance

public static X509StreamParser getInstance(java.lang.String type,
                                           java.lang.String provider)
                                    throws NoSuchParserException,
                                           java.security.NoSuchProviderException
Generates a X509StreamParser object for the specified type from the specified provider.

Parameters:
type - the name of the requested X.509 object type.
provider - the name of the provider.
Returns:
a X509StreamParser object for the specified type.
Throws:
NoSuchParserException - if the type is not available from the specified provider.
java.security.NoSuchProviderException - if the provider can not be found.
See Also:
Provider

getInstance

public static X509StreamParser getInstance(java.lang.String type,
                                           java.security.Provider provider)
                                    throws NoSuchParserException
Generates a X509StreamParser object for the specified type from the specified provider.

Parameters:
type - the name of the requested X.509 object type.
provider - the Provider to use.
Returns:
a X509StreamParser object for the specified type.
Throws:
NoSuchParserException - if the type is not available from the specified provider.
See Also:
Provider

createParser

private static X509StreamParser createParser(X509Util.Implementation impl)

getProvider

public java.security.Provider getProvider()

init

public void init(java.io.InputStream stream)

init

public void init(byte[] data)

read

public java.lang.Object read()
                      throws StreamParsingException
Specified by:
read in interface StreamParser
Throws:
StreamParsingException

readAll

public java.util.Collection readAll()
                             throws StreamParsingException
Specified by:
readAll in interface StreamParser
Throws:
StreamParsingException