Package io.milton.common
Class FileDeletingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- io.milton.common.FileDeletingInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class FileDeletingInputStream extends 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
-
-
Constructor Summary
Constructors Constructor Description FileDeletingInputStream(File tempFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidfinalize()intread()intread(byte[] b)intread(byte[] b, int off, int len)voidreset()-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, skip, transferTo
-
-
-
-
Constructor Detail
-
FileDeletingInputStream
public FileDeletingInputStream(File tempFile) throws FileNotFoundException
- Throws:
FileNotFoundException
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-