org.restlet.util
Class ByteReadingListener

java.lang.Object
  extended by org.restlet.util.ReadingListener
      extended by org.restlet.util.ByteReadingListener
All Implemented Interfaces:
SelectionListener
Direct Known Subclasses:
CharacterReadingListener

public abstract class ByteReadingListener
extends ReadingListener

Selection listener notifying new content as an InputStream.

Author:
Jerome Louvel

Constructor Summary
ByteReadingListener(Representation source)
          Default constructor.
ByteReadingListener(Representation source, int bufferSize)
          Constructor.
 
Method Summary
protected  void onContent(ByteBuffer byteBuffer)
          Callback invoked when new content is available.
protected abstract  void onContent(InputStream inputStream)
          Callback invoked when new content is available.
 
Methods inherited from class org.restlet.util.ReadingListener
onEnd, onError, onSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteReadingListener

public ByteReadingListener(Representation source)
                    throws IOException
Default constructor. Uses a byte buffer of IoUtils.BUFFER_SIZE length.

Parameters:
source - The source representation.
Throws:
IOException

ByteReadingListener

public ByteReadingListener(Representation source,
                           int bufferSize)
                    throws IOException
Constructor. Uses a byte buffer of a given size.

Parameters:
source - The source byte channel.
bufferSize - The byte buffer to use.
Throws:
IOException
Method Detail

onContent

protected final void onContent(ByteBuffer byteBuffer)
Callback invoked when new content is available.

Specified by:
onContent in class ReadingListener
Parameters:
byteBuffer - The byte buffer filled with the new content (correctly flip).

onContent

protected abstract void onContent(InputStream inputStream)
Callback invoked when new content is available.

Parameters:
inputStream - The input stream allowing to retrieve the new content.


Copyright © 2005-2013 Restlet.