org.apache.tools.ant.util

Class LazyFileOutputStream

public class LazyFileOutputStream extends OutputStream

Class that delays opening the output file until the first bytes shall be written or the method {@link #open open} has been invoked explicitly.

Since: Ant 1.6

Constructor Summary
LazyFileOutputStream(String name)
Creates a stream that will eventually write to the file with the given name and replace it.
LazyFileOutputStream(String name, boolean append)
Creates a stream that will eventually write to the file with the given name and optionally append to instead of replacing it.
LazyFileOutputStream(File f)
Creates a stream that will eventually write to the file with the given name and replace it.
LazyFileOutputStream(File file, boolean append)
Creates a stream that will eventually write to the file with the given name and optionally append to instead of replacing it.
LazyFileOutputStream(File file, boolean append, boolean alwaysCreate)
Creates a stream that will eventually write to the file with the given name, optionally append to instead of replacing it, and optionally always create a file (even if zero length).
Method Summary
voidclose()
voidopen()
Explicitly open the file for writing.
voidwrite(byte[] b)
Delegates to the three-arg version.
voidwrite(byte[] b, int offset, int len)
voidwrite(int b)

Constructor Detail

LazyFileOutputStream

public LazyFileOutputStream(String name)
Creates a stream that will eventually write to the file with the given name and replace it.

LazyFileOutputStream

public LazyFileOutputStream(String name, boolean append)
Creates a stream that will eventually write to the file with the given name and optionally append to instead of replacing it.

LazyFileOutputStream

public LazyFileOutputStream(File f)
Creates a stream that will eventually write to the file with the given name and replace it.

LazyFileOutputStream

public LazyFileOutputStream(File file, boolean append)
Creates a stream that will eventually write to the file with the given name and optionally append to instead of replacing it.

LazyFileOutputStream

public LazyFileOutputStream(File file, boolean append, boolean alwaysCreate)
Creates a stream that will eventually write to the file with the given name, optionally append to instead of replacing it, and optionally always create a file (even if zero length).

Method Detail

close

public void close()

open

public void open()
Explicitly open the file for writing.

Returns silently if the file has already been opened.

write

public void write(byte[] b)
Delegates to the three-arg version.

write

public void write(byte[] b, int offset, int len)

write

public void write(int b)
Copyright