public class ConsumingInputStream extends InputStream
InputStream getting its contents from consuming an OutputStream.
The InputStream will be immediately available for reading after construction, regardless
of how much data that will be produced by the OutputStream.| Modifier and Type | Class and Description |
|---|---|
static class |
ConsumingInputStream.ProducerFailed |
| Constructor and Description |
|---|
ConsumingInputStream(ExecutorService executorService,
Consumer<? super OutputStream> write) |
ConsumingInputStream(ExecutorService executorService,
Function<OutputStream,S> outputStreamDecorator,
Consumer<? super S> write) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
public ConsumingInputStream(ExecutorService executorService, Consumer<? super OutputStream> write)
public ConsumingInputStream(ExecutorService executorService, Function<OutputStream,S> outputStreamDecorator, Consumer<? super S> write)
executorService - The executorService to use to start producing data which will be readable by this inputstream.outputStreamDecorator - An Fn to wrap the outputstream to push data to. This Fn must
always wrap the given OutputStream in the OutputStream returned from this Fn,
i.e. the resulting OutputStream must be constructed by wrapping the given OutputStream as
a constructor argument. (E.g. new ZipOutputStream(givenOutputStream).write - The data producing logic. This Do will be given the OutputStream resulting from the
outputStreamDecorator.public int read()
throws IOException
read in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionpublic int available()
throws IOException
available in class InputStreamIOExceptionpublic void mark(int readlimit)
mark in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreamCopyright © 2016 Digipost. All rights reserved.