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.StringMIME_TYPEstatic java.lang.StringXML_EXTENSIONstatic java.lang.StringXMLNS_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.CharsetgetCharset()java.lang.StringgetMIMEType(Element object)Returns the MIME type of the data read and written by this serializer.ListenerList<XMLSerializerListener>getXMLSerializerListeners()ElementreadObject(java.io.InputStream inputStream)Reads an object from an input stream.ElementreadObject(java.io.Reader reader)voidwriteObject(Element element, java.io.OutputStream outputStream)Writes an object to an output stream.voidwriteObject(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:SerializerReads an object from an input stream.- Specified by:
readObjectin 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:SerializerWrites an object to an output stream.- Specified by:
writeObjectin 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:SerializerReturns the MIME type of the data read and written by this serializer.- Specified by:
getMIMETypein 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()
-
-