2.17.2: 2011-06-17

net.sf.basedb.ws.server
Class TempFileDataSource.TempInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by net.sf.basedb.ws.server.TempFileDataSource.TempInputStream
All Implemented Interfaces:
Closeable
Enclosing class:
TempFileDataSource

private class TempFileDataSource.TempInputStream
extends FilterInputStream

An InputStream implementation that deletes the source file once the entire stream has been read (=any of the read() methods return -1) or when close() is called.


Field Summary
private  File file
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
private TempFileDataSource.TempInputStream(InputStream in, File file)
           
 
Method Summary
 void close()
           
private  void deleteTempFile()
          Delete the temp file if it exists and we know that only one stream is reading from it.
protected  void finalize()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private File file
Constructor Detail

TempFileDataSource.TempInputStream

private TempFileDataSource.TempInputStream(InputStream in,
                                           File file)
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class FilterInputStream
Throws:
IOException

finalize

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

deleteTempFile

private void deleteTempFile()
Delete the temp file if it exists and we know that only one stream is reading from it.


2.17.2: 2011-06-17