Cryptix OpenPGP

cryptix.message
Class MessageFactory

java.lang.Object
  extended bycryptix.message.MessageFactory

public class MessageFactory
extends java.lang.Object

Message factory class that can generate Message objects from their encodings.

Version:
$Revision: 1.2 $
Author:
Edwin Woudt

Constructor Summary
protected MessageFactory(MessageFactorySpi builderSpi, java.security.Provider provider, java.lang.String format)
          Create a new MessageFactory object containing the given SPI object.
 
Method Summary
 Message generateMessage(java.io.InputStream in)
          Generates a message from an input stream.
 java.util.Collection generateMessages(java.io.InputStream in)
          Generates a (possible empty) collection of messages from an input stream.
 java.lang.String getFormat()
          Returns the name of the format of this object.
static MessageFactory getInstance(java.lang.String format)
          Returns a MessageFactory that implements the given format.
static MessageFactory getInstance(java.lang.String format, java.security.Provider provider)
          Returns a MessageFactory from the given provider that implements the given format.
static MessageFactory getInstance(java.lang.String format, java.lang.String provider)
          Returns a MessageFactory from the given provider that implements the given format.
 java.security.Provider getProvider()
          Returns the provider of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageFactory

protected MessageFactory(MessageFactorySpi builderSpi,
                         java.security.Provider provider,
                         java.lang.String format)
Create a new MessageFactory object containing the given SPI object.

Method Detail

getInstance

public static MessageFactory getInstance(java.lang.String format)
                                  throws java.security.NoSuchAlgorithmException
Returns a MessageFactory that implements the given format.

Parameters:
format - the message format. "OpenPGP", for example.
Throws:
java.security.NoSuchAlgorithmException

getInstance

public static MessageFactory getInstance(java.lang.String format,
                                         java.lang.String provider)
                                  throws java.security.NoSuchAlgorithmException,
                                         java.security.NoSuchProviderException
Returns a MessageFactory from the given provider that implements the given format.

Parameters:
format - the message format. "OpenPGP", for example.
provider - the provider name.
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException

getInstance

public static MessageFactory getInstance(java.lang.String format,
                                         java.security.Provider provider)
                                  throws java.security.NoSuchAlgorithmException
Returns a MessageFactory from the given provider that implements the given format.

Parameters:
format - the message format. "OpenPGP", for example.
provider - the provider object.
Throws:
java.security.NoSuchAlgorithmException

getProvider

public final java.security.Provider getProvider()
Returns the provider of this object.


getFormat

public final java.lang.String getFormat()
Returns the name of the format of this object.


generateMessages

public final java.util.Collection generateMessages(java.io.InputStream in)
                                            throws MessageException,
                                                   java.io.IOException
Generates a (possible empty) collection of messages from an input stream.

Note: the entire inputstream will be read when the inputstream does not support the mark() and reset() methods.

Throws:
MessageException
java.io.IOException

generateMessage

public final Message generateMessage(java.io.InputStream in)
                              throws MessageException,
                                     java.io.IOException
Generates a message from an input stream.

Note: the entire inputstream will be read when the inputstream does not support the mark() and reset() methods.

Throws:
MessageException - on a variety of format specific problems.
java.io.IOException

Cryptix OpenPGP

Copyright (C) 1999-2003 The Cryptix Foundation Ltd.