org.restlet.util
Class ReaderListener

java.lang.Object
  extended by org.restlet.util.ReadableListener
      extended by org.restlet.util.InputListener
          extended by org.restlet.util.ReaderListener
All Implemented Interfaces:
SelectionListener
Direct Known Subclasses:
StringListener

public abstract class ReaderListener
extends InputListener

Selection listener notifying new content as a Reader. It relies on the representation's character set for proper character decoding.

Author:
Jerome Louvel

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

Constructor Detail

ReaderListener

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

Parameters:
source - The source representation.
Throws:
IOException

ReaderListener

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

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

onContent

protected final void onContent(InputStream inputStream)
Description copied from class: InputListener
Callback invoked when new content is available.

Specified by:
onContent in class InputListener
Parameters:
inputStream - The input stream allowing to retrieve the new content.

onContent

protected abstract void onContent(Reader reader)
Callback invoked when new content is available.

Parameters:
reader - The reader allowing to retrieve the new content.


Copyright © 2005-2012 Restlet S.A.S..