public abstract class ReadingListener extends java.lang.Object implements SelectionListener
ByteBuffer
.Constructor and Description |
---|
ReadingListener(java.nio.channels.ReadableByteChannel byteChannel,
java.nio.ByteBuffer byteBuffer)
Constructor.
|
ReadingListener(java.nio.channels.ReadableByteChannel byteChannel,
int bufferSize)
Constructor.
|
ReadingListener(Representation source)
Default constructor.
|
ReadingListener(Representation source,
int bufferSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
onContent(java.nio.ByteBuffer byteBuffer)
Callback invoked when new content is available.
|
protected void |
onEnd()
Callback invoked when the end of the representation has been reached.
|
protected void |
onError(java.io.IOException ioe)
Callback invoked when an IO exception occurs.
|
void |
onSelected(SelectionRegistration selectionRegistration)
Callback invoked when new content is available.
|
public ReadingListener(java.nio.channels.ReadableByteChannel byteChannel, java.nio.ByteBuffer byteBuffer) throws java.io.IOException
byteChannel
- The source byte channel.byteBuffer
- The byte buffer to use.java.io.IOException
public ReadingListener(java.nio.channels.ReadableByteChannel byteChannel, int bufferSize) throws java.io.IOException
byteChannel
- The source byte channel.bufferSize
- The size of the byte buffer to use.java.io.IOException
public ReadingListener(Representation source) throws java.io.IOException
IoUtils.BUFFER_SIZE
length.source
- The source representation.java.io.IOException
public ReadingListener(Representation source, int bufferSize) throws java.io.IOException
source
- The source byte channel.bufferSize
- The size of the byte buffer to use.java.io.IOException
protected abstract void onContent(java.nio.ByteBuffer byteBuffer)
byteBuffer
- The byte buffer filled with the new content (correctly flip).protected void onEnd()
protected void onError(java.io.IOException ioe)
Level.WARNING
level.ioe
- The exception caught.public final void onSelected(SelectionRegistration selectionRegistration) throws java.io.IOException
onContent(ByteBuffer)
method or the onEnd()
method or
the onError(IOException)
method.onSelected
in interface SelectionListener
selectionRegistration
- The selected registration.java.io.IOException
Copyright © 2005-2024 Restlet.