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 toin
is kept.NonRestartableInputStreamBuilder(java.io.InputStream in, boolean close)
Constructor, a reference toin
is kept, with option to keep input stream open.
-
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.long
getBytesRead()
-
-
-
Constructor Detail
-
NonRestartableInputStreamBuilder
public NonRestartableInputStreamBuilder(java.io.InputStream in)
Constructor, a reference toin
is kept. Closing ofin
prior to its use by this class will cause IOException's.- Parameters:
in
-
-
NonRestartableInputStreamBuilder
public NonRestartableInputStreamBuilder(java.io.InputStream in, boolean close)
Constructor, a reference toin
is kept, with option to keep input stream open. Closing ofin
prior 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.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
-
getBytesRead
public long getBytesRead()
-
-