public class ReadableSizedChannel extends WrapperChannel<ReadableByteChannel> implements ReadableByteChannel
Constructor and Description |
---|
ReadableSizedChannel(ReadableByteChannel source,
long availableSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected long |
getAvailableSize()
Returns the remaining size that should be read from the source channel.
|
protected boolean |
isEndDetected()
Indicates if the end of the channel has been detected.
|
int |
read(ByteBuffer dst)
Reads some bytes and put them into the destination buffer.
|
protected void |
setAvailableSize(long availableSize)
Sets the remaining size that should be read from the source channel.
|
protected void |
setEndDetected(boolean endDetected)
Indicates if the end of the channel has been detected.
|
close, getWrappedChannel, isOpen
public ReadableSizedChannel(ReadableByteChannel source, long availableSize)
source
- The source channel.availableSize
- The total available size that can be read from the source
channel.protected long getAvailableSize()
protected boolean isEndDetected()
public int read(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
dst
- The destination buffer.IOException
protected void setAvailableSize(long availableSize)
availableSize
- The remaining size that should be read from the source
channel.protected void setEndDetected(boolean endDetected) throws IOException
endDetected
- True if the end of the channel has been detected.IOException
Copyright © 2005–2014. All rights reserved.