|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limewire.nio.channel.AbstractChannelInterestReader
public abstract class AbstractChannelInterestReader
Handles allocating a ByteBuffer of a given size, allows chained
readers to read from this, deals with propagating interest to a
source channel, propagates close and isOpen,
implements a stubbed-out handleIOException, and marks when
the channel has been shutdown.
Subclasses only need to implement handleRead to move data from
the source channel into the buffer and react to what was read.
| Field Summary | |
|---|---|
protected ByteBuffer |
buffer
Implementors should write to buffer. |
protected boolean |
shutdown
|
protected InterestReadableByteChannel |
source
|
| Constructor Summary | |
|---|---|
AbstractChannelInterestReader(int bufferSize)
|
|
| Method Summary | |
|---|---|
void |
close()
|
InterestReadableByteChannel |
getReadChannel()
Gets the source channel. |
void |
handleIOException(IOException iox)
Notification that an IOException occurred while dispatching. |
void |
interestRead(boolean status)
Allows this ReadableByteChannel to be told that someone is
no longer interested in reading from it. |
boolean |
isOpen()
|
int |
read(ByteBuffer dst)
|
long |
read(ByteBuffer[] dst)
|
long |
read(ByteBuffer[] dst,
int offset,
int length)
|
void |
setReadChannel(InterestReadableByteChannel newChannel)
Set the source channel |
void |
shutdown()
Releases any resources used by this component. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.limewire.nio.observer.ReadObserver |
|---|
handleRead |
| Field Detail |
|---|
protected ByteBuffer buffer
buffer.
protected InterestReadableByteChannel source
protected boolean shutdown
| Constructor Detail |
|---|
public AbstractChannelInterestReader(int bufferSize)
| Method Detail |
|---|
public int read(ByteBuffer dst)
read in interface ReadableByteChannelpublic long read(ByteBuffer[] dst)
read in interface ScatteringByteChannel
public long read(ByteBuffer[] dst,
int offset,
int length)
read in interface ScatteringByteChannelpublic void shutdown()
Shutdownable
shutdown must never throw any exceptions.
shutdown in interface Shutdownablepublic InterestReadableByteChannel getReadChannel()
ChannelReader
getReadChannel in interface ChannelReaderpublic void setReadChannel(InterestReadableByteChannel newChannel)
ChannelReader
setReadChannel in interface ChannelReaderpublic void interestRead(boolean status)
InterestReadableByteChannelReadableByteChannel to be told that someone is
no longer interested in reading from it. Conversely, you can signal
interest in reading.
interestRead in interface InterestReadableByteChannelstatus - true means interest in reading, false means a lack of
interest.
public void close()
throws IOException
close in interface Closeableclose in interface ChannelIOExceptionpublic boolean isOpen()
isOpen in interface Channelpublic void handleIOException(IOException iox)
IOErrorObserverIOException occurred while dispatching.
handleIOException in interface IOErrorObserver
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||