org.apache.cocoon.ant
Class DelayedFileOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.apache.cocoon.ant.DelayedFileOutputStream

public class DelayedFileOutputStream
extends OutputStream

A output stream writing to a ByteArrayOutputStream, until FilOutputStream target is defined.

Version:
CVS $Id: DelayedFileOutputStream.java 155061 2005-02-23 20:10:26Z cziegeler $
Author:
huber@apache.org

Constructor Summary
DelayedFileOutputStream()
          Constructor for the DelayedFileOutputStream object, create a ByteArrayOutputStream only
 
Method Summary
 void close()
          Close ByteArrayOutputStrem, and FileOutputStream, depending on inner state of this stream
 void flush()
          Flush ByteArrayOutputStrem, writing content to FileOutputStream, flush FileOutputStream
 void setFileOutputStream(File file)
          Creates a file output stream to write to the file represented by the specified File object.
 void setFileOutputStream(File file, boolean append)
          Creates a file output stream to write to the file represented by the specified File object.
 void setFileOutputStream(FileDescriptor fdObj)
          Creates an output file stream to write to the specified file descriptor, which represents an existing connection to an actual file in the file system.
 void setFileOutputStream(String name)
          Creates an output file stream to write to the file with the specified name.
 void setFileOutputStream(String name, boolean append)
          Creates an output file stream to write to the file with the specified name.
 void write(byte[] b)
          Write into ByteArrayOutputStrem, or FileOutputStream, depending on inner state of this stream
 void write(byte[] b, int off, int len)
          Write into ByteArrayOutputStrem, or FileOutputStream, depending on inner state of this stream
 void write(int b)
          Write into ByteArrayOutputStrem, or FileOutputStream, depending on inner state of this stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelayedFileOutputStream

public DelayedFileOutputStream()
Constructor for the DelayedFileOutputStream object, create a ByteArrayOutputStream only

Method Detail

setFileOutputStream

public void setFileOutputStream(File file)
                         throws FileNotFoundException
Creates a file output stream to write to the file represented by the specified File object.

Parameters:
file - The new fileOutputStream value
Throws:
FileNotFoundException - thrown if creating of FileOutputStream fails

setFileOutputStream

public void setFileOutputStream(File file,
                                boolean append)
                         throws IOException
Creates a file output stream to write to the file represented by the specified File object.

Parameters:
file - The new fileOutputStream value
append - The new fileOutputStream value
Throws:
IOException - thrown if creating of FileOutputStream fails

setFileOutputStream

public void setFileOutputStream(FileDescriptor fdObj)
Creates an output file stream to write to the specified file descriptor, which represents an existing connection to an actual file in the file system.

Parameters:
fdObj - The new fileOutputStream value

setFileOutputStream

public void setFileOutputStream(String name)
                         throws FileNotFoundException
Creates an output file stream to write to the file with the specified name.

Parameters:
name - The new fileOutputStream value
Throws:
FileNotFoundException - thrown if creating of FileOutputStream fails

setFileOutputStream

public void setFileOutputStream(String name,
                                boolean append)
                         throws FileNotFoundException
Creates an output file stream to write to the file with the specified name.

Parameters:
name - The new fileOutputStream value
append - The new fileOutputStream value
Throws:
FileNotFoundException - thrown if creating of FileOutputStream fails

write

public void write(int b)
           throws IOException
Write into ByteArrayOutputStrem, or FileOutputStream, depending on inner state of this stream

Parameters:
b - Description of Parameter
Throws:
IOException - thrown iff implicitly flush of baos to fos fails, or writing of baos, or fos fails

write

public void write(byte[] b)
           throws IOException
Write into ByteArrayOutputStrem, or FileOutputStream, depending on inner state of this stream

Parameters:
b - Description of Parameter
Throws:
IOException - thrown iff implicitly flush of baos to fos fails, or writing of baos, or fos fails

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Write into ByteArrayOutputStrem, or FileOutputStream, depending on inner state of this stream

Parameters:
b - Description of Parameter
off - Description of Parameter
len - Description of Parameter
Throws:
IOException - thrown iff implicitly flush of baos to fos fails, or writing of baos, or fos fails

close

public void close()
           throws IOException
Close ByteArrayOutputStrem, and FileOutputStream, depending on inner state of this stream

Throws:
IOException - thrown iff implicitly flush of baos to fos fails, or closing of baos, or fos fails

flush

public void flush()
           throws IOException
Flush ByteArrayOutputStrem, writing content to FileOutputStream, flush FileOutputStream

Throws:
IOException - thrown iff implicitly flush of baos to fos fails, or flushing of baos, or fos fails


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.