public class ReadableByteChunksFrameChannel extends Object implements ReadableFrameChannel
addChunk(byte[]). The byte stream
must be in the format of a FrameFile.
This class is used by FrameFileHttpResponseHandler to provide nonblocking
reads from a remote http server.| Modifier and Type | Method and Description |
|---|---|
com.google.common.util.concurrent.ListenableFuture<?> |
addChunk(byte[] chunk)
Adds a chunk of bytes.
|
boolean |
canRead()
Returns whether this channel has a frame or error condition currently available.
|
void |
close()
Releases any resources associated with this readable channel.
|
static ReadableByteChunksFrameChannel |
create(String id)
Create a channel that aims to limit its memory footprint to one frame.
|
void |
doneWriting()
Call method when caller is done adding chunks.
|
long |
getBytesAdded() |
String |
getId() |
boolean |
isErrorOrFinished() |
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
ReadableFrameChannel.isFinished() or ReadableFrameChannel.canRead() would
return true. |
void |
setError(Throwable t)
Clears the channel and replaces it with the given error.
|
public static ReadableByteChunksFrameChannel create(String id)
addChunk(byte[]) immediately once a full frame has been buffered.@Nullable public com.google.common.util.concurrent.ListenableFuture<?> addChunk(byte[] chunk)
doneWriting.public void setError(Throwable t)
public void doneWriting()
public boolean isFinished()
ReadableFrameChannelReadableFrameChannel.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 ReadableFrameChannel.readabilityFuture() for details.isFinished in interface ReadableFrameChannelpublic boolean canRead()
ReadableFrameChannelReadableFrameChannel.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 ReadableFrameChannel.readabilityFuture() for details.canRead in interface ReadableFrameChannelpublic Frame read()
ReadableFrameChannelReadableFrameChannel.canRead() to ensure there is a frame or
error available.read in interface ReadableFrameChannelpublic com.google.common.util.concurrent.ListenableFuture<?> readabilityFuture()
ReadableFrameChannelReadableFrameChannel.isFinished() or ReadableFrameChannel.canRead() would
return true. The future will never resolve to an exception. If something exceptional has happened, the exception
can be retrieved from ReadableFrameChannel.read().readabilityFuture in interface ReadableFrameChannelpublic void close()
ReadableFrameChannelclose in interface Closeableclose in interface AutoCloseableclose in interface ReadableFrameChannelpublic String getId()
public long getBytesAdded()
public boolean isErrorOrFinished()
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.