Package com.attivio.util.stream
Class NonRestartableInputStreamBuilder
- java.lang.Object
-
- com.attivio.util.stream.NonRestartableInputStreamBuilder
-
- All Implemented Interfaces:
InputStreamBuilder,java.io.Closeable,java.lang.AutoCloseable
public class NonRestartableInputStreamBuilder extends java.lang.Object implements InputStreamBuilder
Creates an InputStreamBuilder from an existing InputStream. The wrapped InputStream will only be read once.
-
-
Constructor Summary
Constructors Constructor Description NonRestartableInputStreamBuilder(java.io.InputStream in)Constructor, a reference toinis kept.NonRestartableInputStreamBuilder(java.io.InputStream in, boolean close)Constructor, a reference toinis kept, with option to keep input stream open.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Cleanup any temporary resources associated with the last returned stream.java.io.InputStreamcreateInputStream()Return a stream in a state where no bytes have been read from it yet.longgetBytesRead()
-
-
-
Constructor Detail
-
NonRestartableInputStreamBuilder
public NonRestartableInputStreamBuilder(java.io.InputStream in)
Constructor, a reference toinis kept. Closing ofinprior to its use by this class will cause IOException's.- Parameters:
in-
-
NonRestartableInputStreamBuilder
public NonRestartableInputStreamBuilder(java.io.InputStream in, boolean close)Constructor, a reference toinis kept, with option to keep input stream open. Closing ofinprior to its use by this class will cause IOException's.- Parameters:
in- the input streamclose- if true, stream is closed, otherwise kept open
-
-
Method Detail
-
createInputStream
public java.io.InputStream createInputStream() throws java.io.IOExceptionReturn 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:
createInputStreamin interfaceInputStreamBuilder- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCleanup any temporary resources associated with the last returned stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceInputStreamBuilder- Throws:
java.io.IOException
-
getBytesRead
public long getBytesRead()
-
-