org.apache.axiom.om.ds
Class OMDataSourceExtBase

java.lang.Object
  extended by org.apache.axiom.om.ds.OMDataSourceExtBase
All Implemented Interfaces:
OMDataSource, OMDataSourceExt
Direct Known Subclasses:
ByteArrayDataSource, CharArrayDataSource, InputStreamDataSource

public abstract class OMDataSourceExtBase
extends java.lang.Object
implements OMDataSourceExt

OMDataSourceExtBase is a convenient base class that can be extended by other OMDataSourceExt implementations.


Field Summary
(package private)  java.util.HashMap map
           
 
Constructor Summary
OMDataSourceExtBase()
           
 
Method Summary
private static java.lang.String getCharacterEncoding(javax.xml.stream.XMLStreamWriter writer)
          Get the character set encoding of the XMLStreamWriter
private static java.io.OutputStream getOutputStream(javax.xml.stream.XMLStreamWriter writer)
          Some XMLStreamWriters expose an OutputStream that can be accessed directly.
 java.lang.Object getProperty(java.lang.String key)
          Query a property stored on the OMDataSource
 java.io.InputStream getXMLInputStream(java.lang.String encoding)
          Returns a InputStream representing the xml data
 boolean hasProperty(java.lang.String key)
          Returns true if property is set
private static void reader2writer(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer)
          Simple utility that takes an XMLStreamReader and writes it to an XMLStreamWriter
 void serialize(java.io.OutputStream output, OMOutputFormat format)
          Serializes element data directly to stream.
 void serialize(java.io.Writer writer, OMOutputFormat format)
          Serializes element data directly to writer.
 void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes element data directly to StAX writer.
 java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
          Set a property on the OMDataSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.axiom.om.OMDataSourceExt
close, copy, getObject, getReader, getXMLBytes, isDestructiveRead, isDestructiveWrite
 

Field Detail

map

java.util.HashMap map
Constructor Detail

OMDataSourceExtBase

public OMDataSourceExtBase()
Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String key)
Description copied from interface: OMDataSourceExt
Query a property stored on the OMDataSource

Specified by:
getProperty in interface OMDataSourceExt
Returns:
value or null

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.Object value)
Description copied from interface: OMDataSourceExt
Set a property on the OMDataSource

Specified by:
setProperty in interface OMDataSourceExt
Returns:
old property object or null

hasProperty

public boolean hasProperty(java.lang.String key)
Description copied from interface: OMDataSourceExt
Returns true if property is set

Specified by:
hasProperty in interface OMDataSourceExt
Returns:

getXMLInputStream

public java.io.InputStream getXMLInputStream(java.lang.String encoding)
                                      throws java.io.UnsupportedEncodingException
Description copied from interface: OMDataSourceExt
Returns a InputStream representing the xml data

Specified by:
getXMLInputStream in interface OMDataSourceExt
Parameters:
encoding - String encoding of InputStream
Returns:
InputStream
Throws:
java.io.UnsupportedEncodingException

serialize

public void serialize(java.io.OutputStream output,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: OMDataSource
Serializes element data directly to stream.

Specified by:
serialize in interface OMDataSource
Specified by:
serialize in interface OMDataSourceExt
Parameters:
output - destination stream for element XML text
format - output format information (null if none; may be ignored if not supported by data binding even if supplied)
Throws:
javax.xml.stream.XMLStreamException
See Also:
OMDataSourceExt

serialize

public void serialize(java.io.Writer writer,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: OMDataSource
Serializes element data directly to writer.

Specified by:
serialize in interface OMDataSource
Specified by:
serialize in interface OMDataSourceExt
Parameters:
writer - destination writer for element XML text
format - output format information (null if none; may be ignored if not supported by data binding even if supplied)
Throws:
javax.xml.stream.XMLStreamException
See Also:
OMDataSourceExt

serialize

public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: OMDataSource
Serializes element data directly to StAX writer.

Specified by:
serialize in interface OMDataSource
Specified by:
serialize in interface OMDataSourceExt
Parameters:
xmlWriter - destination writer
Throws:
javax.xml.stream.XMLStreamException
See Also:
OMDataSourceExt

reader2writer

private static void reader2writer(javax.xml.stream.XMLStreamReader reader,
                                  javax.xml.stream.XMLStreamWriter writer)
                           throws javax.xml.stream.XMLStreamException
Simple utility that takes an XMLStreamReader and writes it to an XMLStreamWriter

Parameters:
reader -
writer -
Throws:
javax.xml.stream.XMLStreamException

getOutputStream

private static java.io.OutputStream getOutputStream(javax.xml.stream.XMLStreamWriter writer)
                                             throws javax.xml.stream.XMLStreamException
Some XMLStreamWriters expose an OutputStream that can be accessed directly.

Returns:
OutputStream or null
Throws:
javax.xml.stream.XMLStreamException

getCharacterEncoding

private static java.lang.String getCharacterEncoding(javax.xml.stream.XMLStreamWriter writer)
Get the character set encoding of the XMLStreamWriter

Returns:
String or null