org.apache.pivot.wtk.text
Class PlainTextSerializer

java.lang.Object
  extended by org.apache.pivot.wtk.text.PlainTextSerializer
All Implemented Interfaces:
Serializer<Document>

public class PlainTextSerializer
extends Object
implements Serializer<Document>

Implementation of the Serializer interface that reads and writes a plain text document.


Field Summary
static int BUFFER_SIZE
           
static String MIME_TYPE
           
 
Constructor Summary
PlainTextSerializer()
           
PlainTextSerializer(Charset charset)
           
PlainTextSerializer(String charsetName)
           
 
Method Summary
 String getMIMEType(Document document)
          Returns the MIME type of the data read and written by this serializer.
 Document readObject(InputStream inputStream)
          Reads an object from an input stream.
 Document readObject(Reader reader)
           
 void writeObject(Document document, OutputStream outputStream)
          Writes an object to an output stream.
 void writeObject(Document document, Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIME_TYPE

public static final String MIME_TYPE
See Also:
Constant Field Values

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

PlainTextSerializer

public PlainTextSerializer()

PlainTextSerializer

public PlainTextSerializer(String charsetName)

PlainTextSerializer

public PlainTextSerializer(Charset charset)
Method Detail

readObject

public Document readObject(InputStream inputStream)
                    throws IOException
Description copied from interface: Serializer
Reads an object from an input stream.

Specified by:
readObject in interface Serializer<Document>
Parameters:
inputStream - The data stream from which the object will be read.
Returns:
The deserialized object.
Throws:
IOException

readObject

public Document readObject(Reader reader)
                    throws IOException
Throws:
IOException

writeObject

public void writeObject(Document document,
                        OutputStream outputStream)
                 throws IOException
Description copied from interface: Serializer
Writes an object to an output stream.

Specified by:
writeObject in interface Serializer<Document>
Parameters:
document - The object to serialize.
outputStream - The data stream to which the object will be written.
Throws:
IOException

writeObject

public void writeObject(Document document,
                        Writer writer)
                 throws IOException
Throws:
IOException

getMIMEType

public String getMIMEType(Document document)
Description copied from interface: Serializer
Returns the MIME type of the data read and written by this serializer.

Specified by:
getMIMEType in interface Serializer<Document>
Parameters:
document - If provided, allows the serializer to attach parameters to the returned MIME type containing more detailed information about the data. If null, the base MIME type is returned.