|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.axiom.om.ds.OMDataSourceExtBase
org.apache.axiom.om.ds.InputStreamDataSource
public class InputStreamDataSource
InputStream is an example OMDataSourceExt. Use it to insert a (InputStream, encoding) into an OM Tree. This data source is useful for placing an InputStream into an OM tree, instead of having a deeply nested tree.
Nested Class Summary | |
---|---|
class |
InputStreamDataSource.Data
Object containing the InputStream/encoding pair |
Field Summary | |
---|---|
private static int |
BUFFER_LEN
|
(package private) InputStreamDataSource.Data |
data
|
Fields inherited from class org.apache.axiom.om.ds.OMDataSourceExtBase |
---|
map |
Constructor Summary | |
---|---|
InputStreamDataSource(java.io.InputStream is,
java.lang.String encoding)
Constructor |
Method Summary | |
---|---|
void |
close()
Close the DataSource and free its resources. |
OMDataSourceExt |
copy()
Return a InputStreamDataSource backed by a ByteArrayInputStream |
java.lang.Object |
getObject()
Returns the backing Object. |
javax.xml.stream.XMLStreamReader |
getReader()
Get parser for element data. |
byte[] |
getXMLBytes(java.lang.String encoding)
Returns a byte[] representing the xml data |
java.io.InputStream |
getXMLInputStream(java.lang.String encoding)
Returns a InputStream representing the xml data |
private static void |
inputStream2OutputStream(java.io.InputStream is,
java.io.OutputStream os)
Private utility to write the InputStream contents to the OutputStream. |
boolean |
isDestructiveRead()
Returns true if reading the backing object is destructive. |
boolean |
isDestructiveWrite()
Returns true if writing the backing object is destructive. |
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(javax.xml.stream.XMLStreamWriter xmlWriter)
Serializes element data directly to StAX writer. |
Methods inherited from class org.apache.axiom.om.ds.OMDataSourceExtBase |
---|
getProperty, hasProperty, serialize, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
InputStreamDataSource.Data data
private static final int BUFFER_LEN
Constructor Detail |
---|
public InputStreamDataSource(java.io.InputStream is, java.lang.String encoding)
bytes
- encoding
- Method Detail |
---|
public void serialize(java.io.OutputStream output, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMDataSource
serialize
in interface OMDataSource
serialize
in interface OMDataSourceExt
serialize
in class OMDataSourceExtBase
output
- destination stream for element XML textformat
- output format information (null
if none; may be ignored if not
supported by data binding even if supplied)
javax.xml.stream.XMLStreamException
OMDataSourceExt
public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException
OMDataSource
serialize
in interface OMDataSource
serialize
in interface OMDataSourceExt
serialize
in class OMDataSourceExtBase
xmlWriter
- destination writer
javax.xml.stream.XMLStreamException
OMDataSourceExt
public javax.xml.stream.XMLStreamReader getReader() throws javax.xml.stream.XMLStreamException
OMDataSource
javax.xml.stream.XMLStreamException
public java.io.InputStream getXMLInputStream(java.lang.String encoding) throws java.io.UnsupportedEncodingException
OMDataSourceExt
getXMLInputStream
in interface OMDataSourceExt
getXMLInputStream
in class OMDataSourceExtBase
encoding
- String encoding of InputStream
java.io.UnsupportedEncodingException
public java.lang.Object getObject()
OMDataSourceExt
public boolean isDestructiveRead()
OMDataSourceExt
public boolean isDestructiveWrite()
OMDataSourceExt
public byte[] getXMLBytes(java.lang.String encoding) throws java.io.UnsupportedEncodingException
OMDataSourceExt
encoding
- String encoding of InputStream
java.io.UnsupportedEncodingException
getXMLInputStream
public void close()
OMDataSourceExt
public OMDataSourceExt copy()
private static void inputStream2OutputStream(java.io.InputStream is, java.io.OutputStream os) throws java.io.IOException
is
- os
-
java.io.IOException
private static void reader2writer(javax.xml.stream.XMLStreamReader reader, javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
reader
- writer
-
javax.xml.stream.XMLStreamException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |