Package com.attivio.util.stream
Class FileInputStreamBuilder
- java.lang.Object
-
- com.attivio.util.stream.FileInputStreamBuilder
-
- All Implemented Interfaces:
InputStreamBuilder
,java.io.Closeable
,java.lang.AutoCloseable
public class FileInputStreamBuilder extends java.lang.Object implements InputStreamBuilder
{code}FileInputStreamBuilder{code} is an adapter for a FileInputStream.
-
-
Constructor Summary
Constructors Constructor Description FileInputStreamBuilder(java.io.File f)
Creates a new InpuStreamBuilder for the given file.FileInputStreamBuilder(java.io.File f, boolean deleteOnCleanup)
Creates a new InputStreamBuilder for the given file.FileInputStreamBuilder(java.lang.String s)
Creates a new InputStreamBuilder for the given path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Cleanup any temporary resources associated with the last returned stream.java.io.InputStream
createInputStream()
Return a stream in a state where no bytes have been read from it yet.protected void
finalize()
-
-
-
Constructor Detail
-
FileInputStreamBuilder
public FileInputStreamBuilder(java.io.File f)
Creates a new InpuStreamBuilder for the given file.- Parameters:
f
- file to wrap.
-
FileInputStreamBuilder
public FileInputStreamBuilder(java.io.File f, boolean deleteOnCleanup)
Creates a new InputStreamBuilder for the given file.- Parameters:
f
-deleteOnCleanup
- if true, will delete file when close() is called.
-
FileInputStreamBuilder
public FileInputStreamBuilder(java.lang.String s)
Creates a new InputStreamBuilder for the given path.- Parameters:
s
- path to file
-
-
Method Detail
-
createInputStream
public java.io.InputStream createInputStream() throws java.io.IOException
Return a stream in a state where no bytes have been read from it yet. For example a newly created stream meets these criteria. The caller should handle closing the stream.- Specified by:
createInputStream
in interfaceInputStreamBuilder
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
Cleanup any temporary resources associated with the last returned stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceInputStreamBuilder
- Throws:
java.io.IOException
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-