com.atlassian.core.spool
Class SpoolFileInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FileInputStream
          extended by com.atlassian.core.spool.SpoolFileInputStream
All Implemented Interfaces:
java.io.Closeable

public class SpoolFileInputStream
extends java.io.FileInputStream

A FileInputStream that deletes its input file when closed. Useful for transient file spooling. Because we don't know when a database will have finished using the stream, or if it will close it itself, this class closes the stream when all the data has been read from it.


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

Constructor Detail

SpoolFileInputStream

public SpoolFileInputStream(java.io.File file)
                     throws java.io.FileNotFoundException
Parameters:
file -
Throws:
java.io.FileNotFoundException

SpoolFileInputStream

public SpoolFileInputStream(java.lang.String name)
                     throws java.io.FileNotFoundException
Parameters:
name -
Throws:
java.io.FileNotFoundException
Method Detail

close

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

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FileInputStream
Throws:
java.io.IOException

read

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

read

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


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.