public interface InputSource
This interface defines methods to allow an InputStream or Reader to notify the developer
when and how much data is ready to be read without blocking.
| Modifier and Type | Method and Description |
|---|---|
boolean |
isFinished() |
boolean |
isReady() |
void |
notifyAvailable(ReadHandler handler)
Notify the specified
ReadHandler when any number of bytes or characters can be read without blocking. |
void |
notifyAvailable(ReadHandler handler,
int size)
Notify the specified
ReadHandler when the number of bytes that can be read without blocking is greater or
equal to the specified size. |
int |
readyData() |
void notifyAvailable(ReadHandler handler)
Notify the specified ReadHandler when any number of bytes or characters can be read without blocking.
Invoking this method is equivalent to calling: notifyAvailable(handler, 1).
handler - the ReadHandler to notify.IllegalArgumentException - if handler is null.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.ReadHandler.onDataAvailable(),
ReadHandler.onAllDataRead()void notifyAvailable(ReadHandler handler, int size)
Notify the specified ReadHandler when the number of bytes that can be read without blocking is greater or
equal to the specified size.
handler - the ReadHandler to notify.size - the least number of bytes that must be available before the ReadHandler is invoked.IllegalArgumentException - if handler is null, or if size is 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.ReadHandler.onDataAvailable(),
ReadHandler.onAllDataRead()boolean isFinished()
true when all data for this particular request has been read, otherwise returns
false.int readyData()
boolean isReady()
true if data can be obtained without blocking, otherwise returns false.Copyright © 2017–2020 Oracle Corporation. All rights reserved.