public class NameAwarePurgableFileInputStream extends FileInputStream
Extension of FileInputStream that allows the file to be purged when close() is called.
It also allows the user to obtain a handle to the underlying file by the getFile().
| Constructor and Description |
|---|
NameAwarePurgableFileInputStream(File file) |
NameAwarePurgableFileInputStream(File file,
boolean purgeFileOnClose)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the stream and deletes the file.
|
File |
getFile() |
available, finalize, getChannel, getFD, read, read, read, skipmark, markSupported, resetpublic NameAwarePurgableFileInputStream(File file, boolean purgeFileOnClose) throws FileNotFoundException
Constructor.
file - The file.purgeFileOnClose - If set to true attempts to purge the file when the close() is called.FileNotFoundException - if the file does not exist, is a directory or it cannot be opened for reading.public NameAwarePurgableFileInputStream(File file) throws FileNotFoundException
FileNotFoundExceptionpublic File getFile()
public void close()
throws IOException
Closes the stream and deletes the file. The close will not fail if the file is already deleted or it cannot be deleted.
close in interface Closeableclose in interface AutoCloseableclose in class FileInputStreamIOException - if an I/O error occurs.Copyright © 2017. All rights reserved.