Package org.restlet.util
Class CharacterReadingListener
- java.lang.Object
-
- org.restlet.util.ReadingListener
-
- org.restlet.util.ByteReadingListener
-
- org.restlet.util.CharacterReadingListener
-
- All Implemented Interfaces:
SelectionListener
- Direct Known Subclasses:
StringReadingListener
public abstract class CharacterReadingListener extends ByteReadingListener
Selection listener notifying new content as aReader. It relies on the representation's character set for proper character decoding.
-
-
Field Summary
Fields Modifier and Type Field Description private CharacterSetcharacterSetThe character set of the associated representation.
-
Constructor Summary
Constructors Constructor Description CharacterReadingListener(Representation source)Default constructor.CharacterReadingListener(Representation source, int bufferSize)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidonContent(java.io.InputStream inputStream)Callback invoked when new content is available.protected abstract voidonContent(java.io.Reader reader)Callback invoked when new content is available.-
Methods inherited from class org.restlet.util.ByteReadingListener
onContent
-
Methods inherited from class org.restlet.util.ReadingListener
onEnd, onError, onSelected
-
-
-
-
Field Detail
-
characterSet
private final CharacterSet characterSet
The character set of the associated representation.
-
-
Constructor Detail
-
CharacterReadingListener
public CharacterReadingListener(Representation source) throws java.io.IOException
Default constructor. Uses a byte buffer ofIoUtils.BUFFER_SIZElength.- Parameters:
source- The source representation.- Throws:
java.io.IOException
-
CharacterReadingListener
public CharacterReadingListener(Representation source, int bufferSize) throws java.io.IOException
Constructor. Uses a byte buffer of a given size.- Parameters:
source- The source representation.bufferSize- The byte buffer to use.- Throws:
java.io.IOException
-
-
Method Detail
-
onContent
protected final void onContent(java.io.InputStream inputStream)
Description copied from class:ByteReadingListenerCallback invoked when new content is available.- Specified by:
onContentin classByteReadingListener- Parameters:
inputStream- The input stream allowing to retrieve the new content.
-
onContent
protected abstract void onContent(java.io.Reader reader)
Callback invoked when new content is available.- Parameters:
reader- The reader allowing to retrieve the new content.
-
-