public class InputStreamFactory extends Object implements Closeable
InputStream to be able to close
it via the try-with-resources construct of Java 7.
public void readIt(InputStream inputStream) {
try (InputStream is = new ParallelInputStream(inputStream) {
// Consume the stream
}
}
| Constructor and Description |
|---|
InputStreamFactory(InputStream original)
Creates a new InputStreamFactory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
InputStream |
createInputStream()
Creates a new InputStream with the same data as provided by the InputStream passed on factory creation.
|
public InputStreamFactory(InputStream original) throws IOException
original - the InputStream to be read for extract its data into memory.IOException - if thrown by the original during read.public InputStream createInputStream() throws IOException
IOException - if no data is available.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2016–2017 Apache Software Foundation. All rights reserved.