org.apache.cocoon.environment
Interface WriteableSource

All Superinterfaces:
ModifiableSource, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, Source, XMLizable
All Known Implementing Classes:
AbstractStreamWriteableSource, FileSource

public interface WriteableSource
extends ModifiableSource

A Source that can be written to. It provides two methods that allow for SAX-based and byte-based output.

Callers will use the most appropriate method for their use and it's up to the implementation to handle both sources. For example, an XML-based implementation can use a parser to convert bytes written to the OutputStream to SAX events, and a byte-based implementation (such as file), can use a serializer to convert SAX events to a byte stream.

Version:
CVS $Id: WriteableSource.java,v 1.2.2.1 2002/06/03 15:34:38 vgritsenko Exp $
Author:
Sylvain Wallez

Method Summary
 boolean canCancel(org.xml.sax.ContentHandler handler)
          Can the data sent to a ContentHandler returned by getContentHandler() be cancelled ?
 boolean canCancel(java.io.OutputStream stream)
          Can the data sent to an OutputStream returned by getOutputStream() be cancelled ?
 void cancel(org.xml.sax.ContentHandler handler)
          Cancel the data sent to a ContentHandler returned by getContentHandler().
 void cancel(java.io.OutputStream stream)
          Cancel the data sent to an OutputStream returned by getOutputStream().
 boolean exists()
          Does this source actually exist ?
 org.xml.sax.ContentHandler getContentHandler()
          Get a ContentHandler where an XML document can be written using SAX events.
 java.io.OutputStream getOutputStream()
          Get an InputStream where raw bytes can be written to.
 
Methods inherited from interface org.apache.cocoon.environment.ModifiableSource
refresh
 
Methods inherited from interface org.apache.cocoon.environment.Source
getContentLength, getInputSource, getInputStream, getLastModified, getSystemId
 
Methods inherited from interface org.apache.avalon.excalibur.pool.Recyclable
recycle
 
Methods inherited from interface org.apache.cocoon.xml.XMLizable
toSAX
 

Method Detail

exists

public boolean exists()
Does this source actually exist ?
Returns:
true if the resource exists.

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
                                             throws org.xml.sax.SAXException,
                                                    ProcessingException
Get a ContentHandler where an XML document can be written using SAX events.

Care should be taken that the returned handler can actually be a XMLConsumer supporting also lexical events such as comments.

Returns:
a handler for SAX events

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException,
                                            ProcessingException
Get an InputStream where raw bytes can be written to. The signification of these bytes is implementation-dependent and is not restricted to a serialized XML document.
Returns:
a stream to write to

canCancel

public boolean canCancel(org.xml.sax.ContentHandler handler)
Can the data sent to a ContentHandler returned by getContentHandler() be cancelled ?
Returns:
true if the handler can be cancelled

canCancel

public boolean canCancel(java.io.OutputStream stream)
Can the data sent to an OutputStream returned by getOutputStream() be cancelled ?
Returns:
true if the stream can be cancelled

cancel

public void cancel(org.xml.sax.ContentHandler handler)
            throws java.lang.Exception
Cancel the data sent to a ContentHandler returned by getContentHandler().

After cancel, the handler should no more be used.


cancel

public void cancel(java.io.OutputStream stream)
            throws java.lang.Exception
Cancel the data sent to an OutputStream returned by getOutputStream().

After cancel, the stream should no more be used.



Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.