org.apache.pivot.xml
Class XMLSerializer

java.lang.Object
  extended by org.apache.pivot.xml.XMLSerializer
All Implemented Interfaces:
Serializer<Element>

public class XMLSerializer
extends Object
implements Serializer<Element>

Reads and writes XML data.


Field Summary
static int BUFFER_SIZE
           
static String DEFAULT_CHARSET_NAME
           
static String MIME_TYPE
           
static String XML_EXTENSION
           
static String XMLNS_ATTRIBUTE_PREFIX
           
 
Constructor Summary
XMLSerializer()
           
XMLSerializer(Charset charset)
           
 
Method Summary
 Charset getCharset()
           
 String getMIMEType(Element object)
          Returns the MIME type of the data read and written by this serializer.
 ListenerList<XMLSerializerListener> getXMLSerializerListeners()
           
 Element readObject(InputStream inputStream)
          Reads an object from an input stream.
 Element readObject(Reader reader)
           
 void writeObject(Element element, OutputStream outputStream)
          Writes an object to an output stream.
 void writeObject(Element element, Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_ATTRIBUTE_PREFIX

public static final String XMLNS_ATTRIBUTE_PREFIX
See Also:
Constant Field Values

DEFAULT_CHARSET_NAME

public static final String DEFAULT_CHARSET_NAME
See Also:
Constant Field Values

XML_EXTENSION

public static final String XML_EXTENSION
See Also:
Constant Field Values

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

XMLSerializer

public XMLSerializer()

XMLSerializer

public XMLSerializer(Charset charset)
Method Detail

getCharset

public Charset getCharset()

readObject

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

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

readObject

public Element readObject(Reader reader)
                   throws SerializationException
Throws:
SerializationException

writeObject

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

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

writeObject

public void writeObject(Element element,
                        Writer writer)
                 throws SerializationException
Throws:
SerializationException

getMIMEType

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

Specified by:
getMIMEType in interface Serializer<Element>
Parameters:
object - 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.

getXMLSerializerListeners

public ListenerList<XMLSerializerListener> getXMLSerializerListeners()