net.sf.eos.document
Class Serializer

java.lang.Object
  extended by net.sf.eos.config.Configured
      extended by net.sf.eos.document.Serializer
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
XmlSerializer

public abstract class Serializer
extends Configured

Implementations must serialize and deserialize an EosDocument. An implementation which serialized a document thru th serialize(EosDocument, Writer) implementation must deserialize it thru the corresponding deserialize(Reader) method.

Author:
Sascha Kohlmann

Field Summary
static String SERIALIZER_IMPL_CONFIG_NAME
          The configuration key name for the classname of the serializer.
 
Constructor Summary
protected Serializer()
           
 
Method Summary
abstract  EosDocument deserialize(Reader in)
          Implementations must deserialize a EosDocument which are serialized by serialize(EosDocument,Writer).
static Serializer newInstance(Configuration config)
           
abstract  void serialize(EosDocument doc, Writer out)
          Implementations serializes the content of an EosDocument thru the given writer
 
Methods inherited from class net.sf.eos.config.Configured
configure, getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIALIZER_IMPL_CONFIG_NAME

@ConfigurationKey(type=CLASSNAME,
                  description="Implementation supports serialization and deserialization of EosDocuments.")
public static final String SERIALIZER_IMPL_CONFIG_NAME
The configuration key name for the classname of the serializer.

See Also:
newInstance(Configuration), Constant Field Values
Constructor Detail

Serializer

protected Serializer()
Method Detail

newInstance

@FactoryMethod(key="net.sf.eos.document.Serializer.impl",
               implementation=XmlSerializer.class)
public static final Serializer newInstance(Configuration config)
                                    throws EosException
Throws:
EosException

serialize

public abstract void serialize(EosDocument doc,
                               Writer out)
                        throws IOException
Implementations serializes the content of an EosDocument thru the given writer

Parameters:
doc - the document to serialize
out - the sink to write the content thru
Throws:
IOException - if something goes wrong during serialization

deserialize

public abstract EosDocument deserialize(Reader in)
                                 throws Exception,
                                        IOException
Implementations must deserialize a EosDocument which are serialized by serialize(EosDocument,Writer).

Parameters:
in - the stream to read the EosDocument content from
Returns:
a EosDocument constructed form the content
Throws:
Exception - if an error occurs during deserilization
IOException - if in occurs an error


Copyright © 2008. All Rights Reserved.