|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.io.InputStream
java.io.PipedInputStream
org.backsource.utils.io.DOMInputStream
A stream that reads from a DOM Document (much like a FileInputStream reads from a file).
With DOMInputStream it is possible to setup an InputStream that reads directly from a DOM Document without having to write it out to an OutputStream first. This is however done with the use of two threads; so this class should probably not be used in EJB:s.
Since the DOM tree is serializised it is important to notice that the same behaviour as when doing a default transformations i valid: i.e one has to set encoding and stuff like this if the default behaviour is not good enough.It is possible to use the generic setPropertyMethod to do this; or some of the convinience methods. Use the OutputKeys properties. All tese properties must be set before any reads are done from the stream.
To solve resolve problems it is possible to use the ResolverContext to set a se.tim.utils.xml.Resolver that should be used during serialization.
Here are some example of properties to set:
// Make output indented
is.setProperty(OutputKeys.INDENT, "yes");
// Set another encoding that UTF-8
is.setProperty(OutputKeys.ENCODING, "iso-8859-1");
// Don't include XML prolog
is.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
| Field Summary |
| Fields inherited from class java.io.PipedInputStream |
buffer, in, out, PIPE_SIZE |
| Constructor Summary | |
DOMInputStream(org.w3c.dom.Document doc)
|
|
| Method Summary | |
void |
close()
Close the serializer and this stream. |
org.w3c.dom.Document |
getDocument()
Get the Document this stream reads from. |
java.lang.String |
getProperty(java.lang.String name)
Check if a specific property is set. |
int |
read()
Start the serializing thread if first read and delegates to parent;reports any exceptions also from the serializer thread |
int |
read(byte[] b,
int off,
int len)
Read, and report any exceptions also from the serializer thread; delegates to parent. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Set a transformation/serialization property, see OutputKeys for possible types and values. |
protected void |
startDOMWriter()
Start the DOM serializer thread. |
| Methods inherited from class java.io.PipedInputStream |
available, connect, receive |
| Methods inherited from class java.io.InputStream |
mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DOMInputStream(org.w3c.dom.Document doc)
| Method Detail |
public int read()
throws java.io.IOException
java.io.IOException
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
java.io.IOException
public void close()
throws java.io.IOException
java.io.IOException
public void setProperty(java.lang.String name,
java.lang.String value)
OutputKeys for possible types and values.
public java.lang.String getProperty(java.lang.String name)
protected void startDOMWriter()
throws java.io.IOException
java.io.IOExceptionpublic org.w3c.dom.Document getDocument()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||