de.grogra.pf.io
Class StreamAdapter

java.lang.Object
  extended by de.grogra.pf.io.FilterBase
      extended by de.grogra.pf.io.SAXFilterBase
          extended by de.grogra.pf.io.StreamAdapter
All Implemented Interfaces:
DOMSource, FileWriterSource, Filter, FilterSource, InputStreamSource, OutputStreamSource, ReaderSource, SAXSource, VirtualFileWriterSource, WriterSource, RegistryContext, Map, org.xml.sax.XMLReader

public class StreamAdapter
extends SAXFilterBase
implements InputStreamSource, OutputStreamSource, ReaderSource, WriterSource, FileWriterSource, DOMSource, VirtualFileWriterSource


Nested Class Summary
 
Nested classes/interfaces inherited from interface de.grogra.pf.io.FilterSource
FilterSource.MetaDataKey<V>
 
Nested classes/interfaces inherited from interface de.grogra.util.Map
Map.Chain
 
Field Summary
 
Fields inherited from class de.grogra.pf.io.SAXFilterBase
LEX_HANDLER
 
Fields inherited from class de.grogra.pf.io.FilterBase
item, source
 
Fields inherited from interface de.grogra.pf.io.FilterSource
AUTO_PROGRESS, DESTINATION_FILE, DESTINATION_URL
 
Fields inherited from interface de.grogra.pf.io.SAXSource
NAMESPACE_PREFIXES, NAMESPACES
 
Fields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAP
 
Constructor Summary
StreamAdapter(FilterSource source, IOFlavor targetFlavor)
           
 
Method Summary
 org.w3c.dom.Document getDocument()
          Returns the data as a DOM document.
 boolean getFeature(java.lang.String name)
           
 java.io.InputStream getInputStream()
          Returns a stream to obtain the data as a stream of bytes.
 java.io.Reader getReader()
          Returns a reader to obtain the data as a stream of characters.
 long length()
          Returns the total number of bytes of this stream.
 void parse(org.xml.sax.ContentHandler ch, org.xml.sax.ErrorHandler eh, org.xml.sax.ext.LexicalHandler lh, org.xml.sax.DTDHandler dh, org.xml.sax.EntityResolver er)
           
 void setFeature(java.lang.String name, boolean value)
           
 void write(java.io.File out)
          This method writes the data to out.
 void write(FileSystem fs, java.lang.Object out)
          This method writes the data to out.
 void write(java.io.OutputStream out)
          This method writes the data to out.
static void write(OutputStreamSource src, java.io.File out)
           
 void write(java.io.Writer out)
          This method writes the data to out.
static void write(WriterSource src, java.io.File out)
           
 
Methods inherited from class de.grogra.pf.io.SAXFilterBase
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getProperty, parse, parse, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setProperty
 
Methods inherited from class de.grogra.pf.io.FilterBase
get, getFilter, getFlavor, getImpl, getMetaData, getRegistry, getSource, getSystemId, initProgressMonitor, setFlavor, setMetaData, setMetaData, setProgress, setSystemId, toString, toURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.grogra.pf.io.FilterSource
getFilter, getFlavor, getMetaData, getSystemId, initProgressMonitor, setMetaData, setProgress
 
Methods inherited from interface de.grogra.pf.registry.RegistryContext
getRegistry
 

Constructor Detail

StreamAdapter

public StreamAdapter(FilterSource source,
                     IOFlavor targetFlavor)
Method Detail

getDocument

public org.w3c.dom.Document getDocument()
                                 throws java.io.IOException,
                                        org.w3c.dom.DOMException
Description copied from interface: DOMSource
Returns the data as a DOM document.

Specified by:
getDocument in interface DOMSource
Returns:
the data
Throws:
java.io.IOException
org.w3c.dom.DOMException

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
Specified by:
getFeature in interface SAXSource
Specified by:
getFeature in interface org.xml.sax.XMLReader
Overrides:
getFeature in class SAXFilterBase
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: InputStreamSource
Returns a stream to obtain the data as a stream of bytes.

Specified by:
getInputStream in interface InputStreamSource
Returns:
an input stream for the data
Throws:
java.io.IOException

getReader

public java.io.Reader getReader()
                         throws java.io.IOException
Description copied from interface: ReaderSource
Returns a reader to obtain the data as a stream of characters.

Specified by:
getReader in interface ReaderSource
Returns:
a reader for the data
Throws:
java.io.IOException

length

public long length()
Description copied from interface: InputStreamSource
Returns the total number of bytes of this stream. A negative values indicates that this number is unknown.

Specified by:
length in interface InputStreamSource
Returns:
number of bytes

parse

public void parse(org.xml.sax.ContentHandler ch,
                  org.xml.sax.ErrorHandler eh,
                  org.xml.sax.ext.LexicalHandler lh,
                  org.xml.sax.DTDHandler dh,
                  org.xml.sax.EntityResolver er)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Specified by:
parse in interface SAXSource
Throws:
java.io.IOException
org.xml.sax.SAXException

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Specified by:
setFeature in interface SAXSource
Specified by:
setFeature in interface org.xml.sax.XMLReader
Overrides:
setFeature in class SAXFilterBase
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

write

public void write(java.io.File out)
           throws java.io.IOException
Description copied from interface: FileWriterSource
This method writes the data to out.

Specified by:
write in interface FileWriterSource
Parameters:
out - the file to which data is written
Throws:
java.io.IOException

write

public void write(FileSystem fs,
                  java.lang.Object out)
           throws java.io.IOException
Description copied from interface: VirtualFileWriterSource
This method writes the data to out.

Specified by:
write in interface VirtualFileWriterSource
Parameters:
fs - the file system to which data is written
out - the file to which data is written
Throws:
java.io.IOException

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Description copied from interface: OutputStreamSource
This method writes the data to out.

Specified by:
write in interface OutputStreamSource
Parameters:
out - the stream to which data is written
Throws:
java.io.IOException

write

public static void write(OutputStreamSource src,
                         java.io.File out)
                  throws java.io.IOException
Throws:
java.io.IOException

write

public void write(java.io.Writer out)
           throws java.io.IOException
Description copied from interface: WriterSource
This method writes the data to out.

Specified by:
write in interface WriterSource
Parameters:
out - the writer to which data is written
Throws:
java.io.IOException

write

public static void write(WriterSource src,
                         java.io.File out)
                  throws java.io.IOException
Throws:
java.io.IOException