bpp
Class LazyFileOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended bybpp.LazyFileOutputStream

public class LazyFileOutputStream
extends java.io.OutputStream

Read the stream until a difference is noticed, then write the remainder.

This class acts like a FileOutputStream, but intead reads the file until a difference in what is written is noticed. If a change is noticed, the file is written from the first point of difference onward. If no change is noticed, then the file is only read.


Constructor Summary
LazyFileOutputStream(java.io.File _file)
           
LazyFileOutputStream(java.lang.String _fileName)
           
 
Method Summary
 void abandon()
          close without truncating the file to the current write position
 void close()
           
 void flush()
           
 boolean isAbandoned()
           
 boolean isDifferent()
           
 void write(byte[] data)
           
 void write(byte[] data, int offset, int length)
           
 void write(int data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyFileOutputStream

public LazyFileOutputStream(java.lang.String _fileName)
                     throws java.io.IOException

LazyFileOutputStream

public LazyFileOutputStream(java.io.File _file)
                     throws java.io.IOException
Method Detail

isDifferent

public boolean isDifferent()

isAbandoned

public boolean isAbandoned()

abandon

public void abandon()
             throws java.io.IOException
close without truncating the file to the current write position

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] data,
                  int offset,
                  int length)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] data)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(int data)
           throws java.io.IOException
Throws:
java.io.IOException