available() method can be used to determine whether the next read will or will not block.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuffer | |
| private final StreamSourceChannel | |
| private static final int | |
| private static final int | |
| private volatile int | |
| private static final AtomicIntegerFieldUpdater | |
| private volatile long |
| Access | Constructor and Description |
|---|---|
| public | BufferedChannelInputStream(final StreamSourceChannel
the channel to wrap channel, final int the size of the internal buffer bufferSize)Construct a new instance. |
| public | BufferedChannelInputStream(final StreamSourceChannel
the channel to wrap channel, final int the size of the internal buffer bufferSize, final long the initial read timeout, or O for none timeout, final TimeUnit the time unit for the read timeout unit)Construct a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the number of ready bytes, or 0 for noneOverrides java. Return the number of bytes available to read, or 0 if a subsequent |
| public void | |
| private boolean | |
| private void | |
| public long | Returns: the timeout in the given unitthe time unit unit)Get the read timeout. |
| public int | Returns: the byte read, or -1 if the end of the stream has been reachedImplements abstract java. Read a byte, blocking if necessary. |
| public int | Returns: the number of bytes read, or -1 if the end of the stream has been reachedthe destination array b, int the offset into the array at which bytes should be filled off, int the number of bytes to fill len)Overrides java. Read bytes into an array. |
| public void | setReadTimeout(long
the read timeout, or 0 for none timeout, TimeUnit the time unit unit)Set the read timeout. |
| public long | Returns: the number of bytes skipped (0 if the end of stream has been reached)the number of bytes to skip n)Overrides java. Skip bytes in the stream. |
| buffer | back to summary |
|---|---|
| private final ByteBuffer buffer | |
| channel | back to summary |
|---|---|
| private final StreamSourceChannel channel | |
| FLAG_ENTERED | back to summary |
|---|---|
| private static final int FLAG_ENTERED | |
| FLAG_EOF | back to summary |
|---|---|
| private static final int FLAG_EOF | |
| flags | back to summary |
|---|---|
private volatile int flags
| |
| flagsUpdater | back to summary |
|---|---|
| private static final AtomicIntegerFieldUpdater<BufferedChannelInputStream> flagsUpdater | |
| timeout | back to summary |
|---|---|
| private volatile long timeout | |
| BufferedChannelInputStream | back to summary |
|---|---|
| public BufferedChannelInputStream(final StreamSourceChannel channel, final int bufferSize) Construct a new instance.
| |
| BufferedChannelInputStream | back to summary |
|---|---|
| public BufferedChannelInputStream(final StreamSourceChannel channel, final int bufferSize, final long timeout, final TimeUnit unit) Construct a new instance.
| |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Return the number of bytes available to read, or 0 if a subsequent
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Close the stream. Shuts down the channel's read side.
| |
| enter | back to summary |
|---|---|
| private boolean enter() | |
| exit | back to summary |
|---|---|
| private void exit(boolean setEof) | |
| getReadTimeout | back to summary |
|---|---|
| public long getReadTimeout(TimeUnit unit) Get the read timeout.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Read a byte, blocking if necessary.
| |
| read | back to summary |
|---|---|
| public int read(final byte[] b, int off, int len) throws IOException Overrides java. Read bytes into an array.
| |
| setReadTimeout | back to summary |
|---|---|
| public void setReadTimeout(long timeout, TimeUnit unit) Set the read timeout. Does not affect read operations in progress.
| |
| skip | back to summary |
|---|---|
| public long skip(long n) throws IOException Overrides java. Skip bytes in the stream.
| |