Package org.apache.pivot.xml
Class XMLSerializer
- java.lang.Object
-
- org.apache.pivot.xml.XMLSerializer
-
- All Implemented Interfaces:
Serializer<Element>
public class XMLSerializer extends java.lang.Object implements Serializer<Element>
Reads and writes XML data.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MIME_TYPE
static java.lang.String
XML_EXTENSION
static java.lang.String
XMLNS_ATTRIBUTE_PREFIX
-
Constructor Summary
Constructors Constructor Description XMLSerializer()
XMLSerializer(java.nio.charset.Charset charset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.charset.Charset
getCharset()
java.lang.String
getMIMEType(Element object)
Returns the MIME type of the data read and written by this serializer.ListenerList<XMLSerializerListener>
getXMLSerializerListeners()
Element
readObject(java.io.InputStream inputStream)
Reads an object from an input stream.Element
readObject(java.io.Reader reader)
void
writeObject(Element element, java.io.OutputStream outputStream)
Writes an object to an output stream.void
writeObject(Element element, java.io.Writer writer)
-
-
-
Field Detail
-
XMLNS_ATTRIBUTE_PREFIX
public static final java.lang.String XMLNS_ATTRIBUTE_PREFIX
- See Also:
- Constant Field Values
-
XML_EXTENSION
public static final java.lang.String XML_EXTENSION
- See Also:
- Constant Field Values
-
MIME_TYPE
public static final java.lang.String MIME_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCharset
public java.nio.charset.Charset getCharset()
-
readObject
public Element readObject(java.io.InputStream inputStream) throws java.io.IOException, SerializationException
Description copied from interface:Serializer
Reads an object from an input stream.- Specified by:
readObject
in interfaceSerializer<Element>
- Parameters:
inputStream
- The data stream from which the object will be read.- Returns:
- The deserialized object.
- Throws:
java.io.IOException
- for any errors accessing or reading the object.SerializationException
- for any formatting errors encountered while deserializing the object.
-
readObject
public Element readObject(java.io.Reader reader) throws SerializationException
- Throws:
SerializationException
-
writeObject
public void writeObject(Element element, java.io.OutputStream outputStream) throws java.io.IOException, SerializationException
Description copied from interface:Serializer
Writes an object to an output stream.- Specified by:
writeObject
in interfaceSerializer<Element>
- Parameters:
element
- The object to serialize.outputStream
- The data stream to which the object will be written.- Throws:
java.io.IOException
- for any errors accessing or reading the object.SerializationException
- for any formatting errors encountered while deserializing the object.
-
writeObject
public void writeObject(Element element, java.io.Writer writer) throws SerializationException
- Throws:
SerializationException
-
getMIMEType
public java.lang.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 interfaceSerializer<Element>
- Parameters:
object
- If provided, allows the serializer to attach parameters to the returned MIME type containing more detailed information about the data. Ifnull
, the base MIME type is returned.- Returns:
- The MIME type of the current data.
-
getXMLSerializerListeners
public ListenerList<XMLSerializerListener> getXMLSerializerListeners()
-
-