org.das2.util
Class StreamTool

java.lang.Object
  extended by org.das2.util.StreamTool

public class StreamTool
extends java.lang.Object


Nested Class Summary
static class StreamTool.DelimeterNotFoundException
           
 
Constructor Summary
StreamTool()
          Creates a new instance of StreamTool
 
Method Summary
static byte[] advanceTo(java.io.InputStream in, byte[] delim)
           
static void formatHeader(org.w3c.dom.Document document, java.io.Writer writer)
           
static java.util.Map processPropertiesElement(org.w3c.dom.Element element)
           
static org.w3c.dom.Element processPropertiesMap(org.w3c.dom.Document document, java.util.Map properties)
           
static void readStream(java.nio.channels.ReadableByteChannel stream, StreamHandler handler)
           
static java.nio.ByteBuffer readXML(java.nio.ByteBuffer input)
           
static byte[] readXML(java.io.PushbackInputStream in)
          Read off XML data from the InputStream up to the termination of the XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamTool

public StreamTool()
Creates a new instance of StreamTool

Method Detail

advanceTo

public static byte[] advanceTo(java.io.InputStream in,
                               byte[] delim)
                        throws java.io.IOException,
                               StreamTool.DelimeterNotFoundException
Throws:
java.io.IOException
StreamTool.DelimeterNotFoundException

readXML

public static byte[] readXML(java.io.PushbackInputStream in)
                      throws java.io.IOException
Read off XML data from the InputStream up to the termination of the XML. XML data is returned in a byte array. The InputStream is left just following the XML terminator. Processing is done with as little interpretation as possible, so invalid XML will cause problems with little feedback about what's wrong.

Throws:
java.io.IOException

readXML

public static java.nio.ByteBuffer readXML(java.nio.ByteBuffer input)
                                   throws java.io.IOException
Throws:
java.io.IOException

readStream

public static void readStream(java.nio.channels.ReadableByteChannel stream,
                              StreamHandler handler)
                       throws StreamException
Throws:
StreamException

formatHeader

public static void formatHeader(org.w3c.dom.Document document,
                                java.io.Writer writer)
                         throws StreamException
Throws:
StreamException

processPropertiesElement

public static java.util.Map processPropertiesElement(org.w3c.dom.Element element)
                                              throws StreamException
Throws:
StreamException

processPropertiesMap

public static org.w3c.dom.Element processPropertiesMap(org.w3c.dom.Document document,
                                                       java.util.Map properties)