Package dev.getelements.elements.rt.util
Class InputStreamAdapter
java.lang.Object
java.io.InputStream
dev.getelements.elements.rt.util.InputStreamAdapter
- All Implemented Interfaces:
Closeable
,AutoCloseable
Wraps an instance of
ReadableByteChannel
using a ByteBuffer
. It is not recommended to use a
ReadableByteChannel
that is in non-blocking mode with this particular type, as it will raise an instance of
IOException
if the channel returns zero bytes from the channel.
During hte process of reading, this may have read more bytes from the underlying ReadableByteChannel
than
was consumed by the actual stream operations. However, when this InputStreamAdapter
is closed, it will ensure
that any remaining unread bytes are preserved in the state of the backing ByteBuffer
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Indicates as to whether or not the underlyingReadableByteChannel
should be closed when this is closed -
Constructor Summary
ConstructorsConstructorDescriptionInputStreamAdapter
(ReadableByteChannel rbc, ByteBuffer byteBuffer, int options) -
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Field Details
-
CLOSE
public static final int CLOSEIndicates as to whether or not the underlyingReadableByteChannel
should be closed when this is closed- See Also:
-
-
Constructor Details
-
InputStreamAdapter
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
public int available()- Overrides:
available
in classInputStream
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-