Package org.glassfish.grizzly
Interface InputSource
-
public interface InputSourceThis interface defines methods to allow an
InputStreamorReaderto notify the developer when and how much data is ready to be read without blocking.- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisFinished()booleanisReady()voidnotifyAvailable(ReadHandler handler)Notify the specifiedReadHandlerwhen any number of bytes or characters can be read without blocking.voidnotifyAvailable(ReadHandler handler, int size)Notify the specifiedReadHandlerwhen the number of bytes that can be read without blocking is greater or equal to the specifiedsize.intreadyData()
-
-
-
Method Detail
-
notifyAvailable
void notifyAvailable(ReadHandler handler)
Notify the specified
ReadHandlerwhen any number of bytes or characters can be read without blocking.Invoking this method is equivalent to calling: notifyAvailable(handler, 1).
- Parameters:
handler- theReadHandlerto notify.- Throws:
IllegalArgumentException- ifhandlerisnull.IllegalStateException- if an attempt is made to register a handler before an existing registered handler has been invoked or if all request data has already been read.- See Also:
ReadHandler.onDataAvailable(),ReadHandler.onAllDataRead()
-
notifyAvailable
void notifyAvailable(ReadHandler handler, int size)
Notify the specified
ReadHandlerwhen the number of bytes that can be read without blocking is greater or equal to the specifiedsize.- Parameters:
handler- theReadHandlerto notify.size- the least number of bytes that must be available before theReadHandleris invoked.- Throws:
IllegalArgumentException- ifhandlerisnull, or ifsizeis less or equal to zero.IllegalStateException- if an attempt is made to register a handler before an existing registered handler has been invoked or if all request data has already been read.- See Also:
ReadHandler.onDataAvailable(),ReadHandler.onAllDataRead()
-
isFinished
boolean isFinished()
- Returns:
truewhen all data for this particular request has been read, otherwise returnsfalse.
-
readyData
int readyData()
- Returns:
- the number of bytes (or characters) that may be obtained without blocking. Note when dealing with characters, this method may return an estimate on the number of characters available.
-
isReady
boolean isReady()
- Returns:
trueif data can be obtained without blocking, otherwise returnsfalse.
-
-