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:
Closeable

public class SpoolFileInputStream
extends 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(File file)
           
SpoolFileInputStream(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(File file)
                     throws FileNotFoundException
Parameters:
file -
Throws:
FileNotFoundException

SpoolFileInputStream

public SpoolFileInputStream(String name)
                     throws FileNotFoundException
Parameters:
name -
Throws:
FileNotFoundException
Method Detail

close

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

read

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

read

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

read

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


Copyright © 2015 Atlassian. All rights reserved.