public interface ReadableFrameChannel extends Closeable
canRead()
and
readabilityFuture()
methods.
May be implemented using an in-memory queue, disk file, stream, etc.
Channels implementing this interface are used by a single reader; they do not support concurrent reads.Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Returns whether this channel has a frame or error condition currently available.
|
void |
close()
Releases any resources associated with this readable channel.
|
boolean |
isFinished()
Returns whether this channel is finished.
|
Frame |
read()
Returns the next available frame from this channel.
|
com.google.common.util.concurrent.ListenableFuture<?> |
readabilityFuture()
Returns a future that will resolve when either
isFinished() or canRead() would
return true. |
boolean isFinished()
close()
and then
discard it.
Note that it is possible for a channel to be unfinished and also have no available frames or errors. This happens
when it is not in a ready-for-reading state. See readabilityFuture()
for details.boolean canRead()
read()
to retrieve the frame or error.
Note that it is possible for a channel to be unfinished and also have no available frames or errors. This happens
when it is not in a ready-for-reading state. See readabilityFuture()
for details.Frame read()
canRead()
to ensure there is a frame or
error available.NoSuchElementException
- if there is no frame currently availablecom.google.common.util.concurrent.ListenableFuture<?> readabilityFuture()
isFinished()
or canRead()
would
return true. The future will never resolve to an exception. If something exceptional has happened, the exception
can be retrieved from read()
.void close()
close
in interface AutoCloseable
close
in interface Closeable
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.