@Immutable public class HasInputStream extends Object implements IHasInputStream
IHasInputStream with that has an
InputStream supplier that can be read more than once!| Constructor and Description |
|---|
HasInputStream(ISupplier<? extends InputStream> aISP,
boolean bReadMultiple)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static IHasInputStream |
create(NonBlockingByteArrayOutputStream aBAOS)
Get a special implementation of
IHasInputStream for
NonBlockingByteArrayOutputStream. |
InputStream |
getInputStream()
Get the input stream to read from the object.
|
boolean |
isReadMultiple()
Check if the
InputStream from IHasInputStream.getInputStream() and
IHasInputStream.getBufferedInputStream() can be acquired more than once. |
static HasInputStream |
multiple(ISupplier<? extends InputStream> aISP)
Create a new object with a supplier that can read multiple times.
|
static HasInputStream |
once(ISupplier<? extends InputStream> aISP)
Create a new object with a supplier that can be read only once.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBufferedInputStreampublic HasInputStream(@Nonnull ISupplier<? extends InputStream> aISP, boolean bReadMultiple)
aISP - InputStream supplier. May not be null.bReadMultiple - true if the supplier can be invoked more than once
(e.g. from a byte[]) or false if it can be invoked only
once (e.g. from an open socket).public final boolean isReadMultiple()
IHasInputStreamInputStream from IHasInputStream.getInputStream() and
IHasInputStream.getBufferedInputStream() can be acquired more than once.isReadMultiple in interface IHasInputStreamtrue if the input stream can be acquired more than
once, false if not.public final InputStream getInputStream()
IHasInputStreamInputStream needs to be created.getInputStream in interface IHasInputStreamnull if resolving failed.@Nonnull @ReturnsMutableCopy public static HasInputStream multiple(@Nonnull ISupplier<? extends InputStream> aISP)
aISP - InputStream provider. May not be null.null.@Nonnull @ReturnsMutableCopy public static HasInputStream once(@Nonnull ISupplier<? extends InputStream> aISP)
aISP - InputStream provider. May not be null.null.@Nonnull @ReturnsMutableCopy public static IHasInputStream create(@Nonnull NonBlockingByteArrayOutputStream aBAOS)
IHasInputStream for
NonBlockingByteArrayOutputStream.aBAOS - Source stream. May not be null.null.Copyright © 2014–2019 Philip Helger. All rights reserved.