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 intIndicates as to whether or not the underlyingReadableByteChannelshould 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 underlyingReadableByteChannelshould be closed when this is closed- See Also:
-
-
Constructor Details
-
InputStreamAdapter
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
public int available()- Overrides:
availablein classInputStream
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-