com.bradmcevoy.io
Class FileDeletingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.bradmcevoy.io.FileDeletingInputStream
All Implemented Interfaces:
java.io.Closeable

public class FileDeletingInputStream
extends java.io.InputStream

An inputstream to read a file, and to delete the file when this stream is closed This is useful for situations where you are using a local file to buffer the contents of remote data, and want to ensure that the temporary local file is deleted when it is no longer being used

Author:
brad

Constructor Summary
FileDeletingInputStream(java.io.File tempFile)
           
 
Method Summary
 void close()
           
protected  void finalize()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, skip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDeletingInputStream

public FileDeletingInputStream(java.io.File tempFile)
                        throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException
Method Detail

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 2011. All Rights Reserved.