Package org.restlet.util
Class ByteReadingListener
- java.lang.Object
-
- org.restlet.util.ReadingListener
-
- org.restlet.util.ByteReadingListener
-
- All Implemented Interfaces:
SelectionListener
- Direct Known Subclasses:
CharacterReadingListener
public abstract class ByteReadingListener extends ReadingListener
Selection listener notifying new content as anInputStream
.- Author:
- Jerome Louvel
-
-
Constructor Summary
Constructors Constructor Description ByteReadingListener(Representation source)
Default constructor.ByteReadingListener(Representation source, int bufferSize)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
onContent(java.io.InputStream inputStream)
Callback invoked when new content is available.protected void
onContent(java.nio.ByteBuffer byteBuffer)
Callback invoked when new content is available.-
Methods inherited from class org.restlet.util.ReadingListener
onEnd, onError, onSelected
-
-
-
-
Constructor Detail
-
ByteReadingListener
public ByteReadingListener(Representation source) throws java.io.IOException
Default constructor. Uses a byte buffer ofIoUtils.BUFFER_SIZE
length.- Parameters:
source
- The source representation.- Throws:
java.io.IOException
-
ByteReadingListener
public ByteReadingListener(Representation source, int bufferSize) throws java.io.IOException
Constructor. Uses a byte buffer of a given size.- Parameters:
source
- The source byte channel.bufferSize
- The byte buffer to use.- Throws:
java.io.IOException
-
-
Method Detail
-
onContent
protected final void onContent(java.nio.ByteBuffer byteBuffer)
Callback invoked when new content is available.- Specified by:
onContent
in classReadingListener
- Parameters:
byteBuffer
- The byte buffer filled with the new content (correctly flip).
-
onContent
protected abstract void onContent(java.io.InputStream inputStream)
Callback invoked when new content is available.- Parameters:
inputStream
- The input stream allowing to retrieve the new content.
-
-