Class StreamInputStream<T>
java.lang.Object
java.io.InputStream
io.fluxzero.common.StreamInputStream<T>
- All Implemented Interfaces:
Closeable, AutoCloseable
Exposes the mapped contents of a
Stream as an InputStream without buffering the full stream in
memory.-
Constructor Summary
ConstructorsConstructorDescriptionStreamInputStream(@NonNull Stream<? extends T> stream, @NonNull ThrowingBiConsumer<? super T, ? super OutputStream> writer) Constructs aStreamInputStreaminstance that maps the elements of the givenStreamto anInputStreamrepresentation using a provided writer function. -
Method Summary
Methods inherited from class InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
StreamInputStream
public StreamInputStream(@NonNull @NonNull Stream<? extends T> stream, @NonNull @NonNull ThrowingBiConsumer<? super T, ? super OutputStream> writer) Constructs aStreamInputStreaminstance that maps the elements of the givenStreamto anInputStreamrepresentation using a provided writer function.- Parameters:
stream- the stream containing the elements to be exposed as anInputStream; must not be nullwriter- aThrowingBiConsumerthat writes each element of the stream to anOutputStream; must not be null
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
available
public int available()- Overrides:
availablein classInputStream
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-