public abstract static class FeedableBodyGenerator.NonBlockingFeeder extends FeedableBodyGenerator.BaseFeeder
FeedableBodyGenerator
without blocking.Modifier and Type | Class and Description |
---|---|
static interface |
FeedableBodyGenerator.NonBlockingFeeder.ReadyToFeedListener
Listener to signal that data is available to be fed.
|
feedableBodyGenerator
Constructor and Description |
---|
FeedableBodyGenerator.NonBlockingFeeder(FeedableBodyGenerator feedableBodyGenerator)
Constructs the
NonBlockingFeeder with the associated
FeedableBodyGenerator . |
Modifier and Type | Method and Description |
---|---|
abstract void |
canFeed()
Notification that it's possible to send another block of data via
FeedableBodyGenerator.BaseFeeder.feed(org.glassfish.grizzly.Buffer, boolean) . |
void |
flush()
This method will be invoked when it's possible to begin feeding
data downstream.
|
abstract boolean |
isDone() |
abstract boolean |
isReady() |
abstract void |
notifyReadyToFeed(FeedableBodyGenerator.NonBlockingFeeder.ReadyToFeedListener listener)
Callback registration to signal the
FeedableBodyGenerator that
data is available once again to continue feeding. |
feed
public FeedableBodyGenerator.NonBlockingFeeder(FeedableBodyGenerator feedableBodyGenerator)
NonBlockingFeeder
with the associated
FeedableBodyGenerator
.public abstract void canFeed() throws IOException
FeedableBodyGenerator.BaseFeeder.feed(org.glassfish.grizzly.Buffer, boolean)
.
It's important to only invoke FeedableBodyGenerator.BaseFeeder.feed(Buffer, boolean)
once per invocation of canFeed()
.IOException
public abstract boolean isDone()
true
if all data has been fed by this feeder,
otherwise returns false
.public abstract boolean isReady()
true
if data is available to be fed, otherwise
returns false
. When this method returns false
,
the FeedableBodyGenerator
will call notifyReadyToFeed(ReadyToFeedListener)
by which this FeedableBodyGenerator.NonBlockingFeeder
implementation may signal data is once
again available to be fed.public abstract void notifyReadyToFeed(FeedableBodyGenerator.NonBlockingFeeder.ReadyToFeedListener listener)
FeedableBodyGenerator
that
data is available once again to continue feeding. Once this listener
has been invoked, the NonBlockingFeeder implementation should no longer maintain
a reference to the listener.public void flush() throws IOException
FeedableBodyGenerator.Feeder
FeedableBodyGenerator.Feeder.feed(Buffer, boolean)
to perform the actual write.IOException
- if an I/O error occurs.Copyright © 2014. All Rights Reserved.