public abstract class InputStreamChannel extends java.io.InputStream implements java.nio.channels.ReadableByteChannel, StreamChannel
| Modifier and Type | Field and Description |
|---|---|
protected long |
bytesRead |
protected java.nio.channels.ReadableByteChannel |
channel |
| Modifier | Constructor and Description |
|---|---|
protected |
InputStreamChannel(java.nio.channels.ReadableByteChannel channel) |
| Modifier and Type | Method and Description |
|---|---|
long |
getBytesRead() |
java.lang.Thread |
getParkedThread()
Return the thread if waiting for read/write on this channel.
|
long |
getParkNanosMax()
Maximum time to wait before giving up read/write on channel
|
java.nio.channels.ReadableByteChannel |
getUnderlyingChannel()
Get the underlying
ReadableByteChannel. |
abstract int |
read(java.nio.ByteBuffer dst) |
protected int |
readBuffered(java.nio.ByteBuffer dst,
java.nio.ByteBuffer channelBuffer)
Common base method to read into a given ByteBuffer destination via an
intermediate direct byte buffer owned by the implementation of this class.
|
int |
readFrame() |
int |
readFrameFragment(int fragmentSize) |
abstract int |
readInt()
Reads four input bytes and returns an
int value. |
protected int |
readIntoBuffer(java.nio.ByteBuffer buffer)
Fill the given buffer reading data from channel at least one byte unless
end-of-stream has been reached.
|
protected int |
readIntoBufferNoWait(java.nio.ByteBuffer buffer)
Fill the given buffer reading data from channel whatever is available in
one call (non-blocking if channel is so configured).
|
protected int |
refillBuffer(java.nio.ByteBuffer channelBuffer,
int tryReadBytes,
java.lang.String eofMessage) |
protected int |
refillBufferBase(java.nio.ByteBuffer channelBuffer,
int tryReadBytes,
java.lang.String eofMessage) |
protected void |
resetAndCopyLeftOverBytes(java.nio.ByteBuffer channelBuffer) |
void |
setParkedThread(java.lang.Thread thread)
Set the thread waiting for read/write on this channel (null to clear).
|
available, close, mark, markSupported, read, read, read, reset, skipprotected final java.nio.channels.ReadableByteChannel channel
protected volatile long bytesRead
protected InputStreamChannel(java.nio.channels.ReadableByteChannel channel)
public final java.nio.channels.ReadableByteChannel getUnderlyingChannel()
ReadableByteChannel.public abstract int read(java.nio.ByteBuffer dst)
throws java.io.IOException
read in interface java.nio.channels.ReadableByteChanneljava.io.IOExceptionpublic abstract int readInt()
throws java.io.IOException
int value. Let
a-d be the first through fourth bytes read. The value returned
is:
(((a & 0xff) << 24) | ((b & 0xff) << 16) |
((c & 0xff) << 8) | (d & 0xff))
This method is suitable for reading bytes written by the
writeInt method of interface DataOutput.int value read.java.io.EOFException - if this stream reaches the end before reading all the bytes.java.io.IOException - if an I/O error occurs.public int readFrame()
throws java.io.IOException
java.io.IOExceptionpublic int readFrameFragment(int fragmentSize)
throws java.io.IOException
java.io.IOExceptionprotected final int readBuffered(java.nio.ByteBuffer dst,
java.nio.ByteBuffer channelBuffer)
throws java.io.IOException
java.io.IOExceptionprotected int refillBuffer(java.nio.ByteBuffer channelBuffer,
int tryReadBytes,
java.lang.String eofMessage)
throws java.io.IOException
java.io.IOExceptionprotected final int refillBufferBase(java.nio.ByteBuffer channelBuffer,
int tryReadBytes,
java.lang.String eofMessage)
throws java.io.IOException
java.io.IOExceptionprotected void resetAndCopyLeftOverBytes(java.nio.ByteBuffer channelBuffer)
protected int readIntoBuffer(java.nio.ByteBuffer buffer)
throws java.io.IOException
java.io.IOExceptionpublic final java.lang.Thread getParkedThread()
StreamChannelgetParkedThread in interface StreamChannelpublic final void setParkedThread(java.lang.Thread thread)
StreamChannelsetParkedThread in interface StreamChannelpublic long getParkNanosMax()
StreamChannelgetParkNanosMax in interface StreamChannelprotected int readIntoBufferNoWait(java.nio.ByteBuffer buffer)
throws java.io.IOException
java.io.IOExceptionpublic final long getBytesRead()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.