org.brains2b.coffee.decode
Class DecoderFactory

java.lang.Object
  extended by org.brains2b.coffee.decode.DecoderFactory

public class DecoderFactory
extends java.lang.Object

Factory for creating Decoders and Encoders based on the content of an Article or on the name of the encoding

Version:
1.00 [14-08-2007]
Author:
dennis@brains2b.nl

Constructor Summary
DecoderFactory()
           
 
Method Summary
static Decoder createDecoder(Article a)
          create the appropriate Decoder on the basis of the Article to decode.
static Encoder createEncoder(java.lang.String encoding)
          create an Encoder for the given encoding
static java.lang.String[] getEncoders()
          get the Encoders supported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecoderFactory

public DecoderFactory()
Method Detail

createDecoder

public static final Decoder createDecoder(Article a)
                                   throws java.lang.Exception
create the appropriate Decoder on the basis of the Article to decode.

The supplied article is added to the Decoder with Decoder.decodePiece(String) before returning the Decoder

Parameters:
a - Article, the Article which needs to be decoded
Returns:
Decoder
Throws:
Exception, - thrown if the Decoder.decodePiece(String) was not succesfull.
java.lang.Exception

createEncoder

public static final Encoder createEncoder(java.lang.String encoding)
                                   throws CoffeeSpill
create an Encoder for the given encoding

Parameters:
encoding - String, case insensative name for the encoding, must be one of the values in getEncoders()
Returns:
Encoder
Throws:
CoffeeSpill, - thrown if the encoding supplied is not supported
CoffeeSpill

getEncoders

public static final java.lang.String[] getEncoders()
get the Encoders supported

Returns:
String[] names for the different encodings