org.backsource.utils.io
Class DOMCachedStream

java.lang.Object
  extended byorg.backsource.utils.io.ByteCachedStream
      extended byorg.backsource.utils.io.DOMCachedStream
All Implemented Interfaces:
CachedStream

public class DOMCachedStream
extends ByteCachedStream

A StreamCache that caches data in a DOM Document.

It is important to notice that the streams returned by this class will onky work if given valid XML as data. The cached stream classes used by this cache uses DOMInputStream and DOMOutputStream so any thing valid for them is also vallid from streams achived from this cache.

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman

Constructor Summary
DOMCachedStream()
           
 
Method Summary
 CachedInputStream getInputStream(CachedOutputStream cout)
          Get a rewindable input stream from the given CachedOutputStream.
 CachedInputStream getInputStream(org.w3c.dom.Document doc)
          A DOM specific method that returns a stream configured with any properties set on this CachedStream.
 CachedOutputStream getOutputStream()
          Get a CachedOutputStream that will write to a DOM tree.
 java.lang.String getProperty(java.lang.String name)
          Chech if property is set.
 void setProperty(java.lang.String name, java.lang.String value)
          Set a property,see DOMInputStream for the possible properties.
 
Methods inherited from class org.backsource.utils.io.ByteCachedStream
getInputStream, rewind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMCachedStream

public DOMCachedStream()
Method Detail

getOutputStream

public CachedOutputStream getOutputStream()
                                   throws java.io.IOException
Get a CachedOutputStream that will write to a DOM tree.

The typical usecase for this is to later use it to get a CachedInputStream from it, it is also possible to get the DOM Document from it by using the getSink() method:

        CachedOutputStream cos = cache.getOutputStream();
        //Write to it
        if ( cos instanceof DOMCachedOutputStream) {
           Document doc = (Document)cos.getSink();
        } // end of if ()

Specified by:
getOutputStream in interface CachedStream
Overrides:
getOutputStream in class ByteCachedStream
Throws:
java.io.IOException

getInputStream

public CachedInputStream getInputStream(CachedOutputStream cout)
                                 throws java.io.IOException
Get a rewindable input stream from the given CachedOutputStream.

Specified by:
getInputStream in interface CachedStream
Overrides:
getInputStream in class ByteCachedStream
Throws:
java.io.IOException - of the CachedOutputStream was not a DOMCachedOutputStream.

getInputStream

public CachedInputStream getInputStream(org.w3c.dom.Document doc)
                                 throws java.io.IOException
A DOM specific method that returns a stream configured with any properties set on this CachedStream.

Throws:
java.io.IOException

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Set a property,see DOMInputStream for the possible properties.

Specified by:
setProperty in interface CachedStream
Overrides:
setProperty in class ByteCachedStream

getProperty

public java.lang.String getProperty(java.lang.String name)
Chech if property is set.

Specified by:
getProperty in interface CachedStream
Overrides:
getProperty in class ByteCachedStream


Copyright © 2000-2004 Backsource. All Rights Reserved.