org.apache.excalibur.source
Interface ModifiableSource

All Superinterfaces:
Source
All Known Subinterfaces:
ModifiableTraversableSource
All Known Implementing Classes:
CommonsVFSSource, FileSource, FTPSource, HTTPClientSource

public interface ModifiableSource
extends Source

A Source that can be written to.

As far a possible, implementations should provide a kind of transaction or buffering of data written to the source. This is especially important in stream-based systems such as Cocoon where an error that occurs during the processing should lead to cancelling data written to the source.

This is the role of the canCancel(OutputStream) and cancel(OutputStream) methods.

Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:26 $
Author:
Avalon Development Team

Method Summary
 boolean canCancel(java.io.OutputStream stream)
          Can the data sent to an OutputStream returned by getOutputStream() be cancelled ?
 void cancel(java.io.OutputStream stream)
          Cancel the data sent to an OutputStream returned by getOutputStream().
 void delete()
          Delete the source
 java.io.OutputStream getOutputStream()
          Return an OutputStream to write to.
 
Methods inherited from interface org.apache.excalibur.source.Source
exists, getContentLength, getInputStream, getLastModified, getMimeType, getScheme, getURI, getValidity, refresh
 

Method Detail

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Return an OutputStream to write to. The returned stream must be closed or cancelled by the calling code.

Throws:
java.io.IOException

delete

public void delete()
            throws SourceException
Delete the source

Throws:
SourceException

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(java.io.OutputStream stream)
            throws java.io.IOException
Cancel the data sent to an OutputStream returned by getOutputStream(). Cancelling the stream will also close it.

After cancelling, the stream should no longer be used.

Throws:
java.io.IOException


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.