org.apache.pivot.wtk.text
Class PlainTextSerializer
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
PlainTextSerializer
public PlainTextSerializer()
PlainTextSerializer
public PlainTextSerializer(String charsetName)
PlainTextSerializer
public PlainTextSerializer(Charset charset)
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.