Package io.undertow.httpcore
Interface InputChannel
public interface InputChannel
-
Method Summary
Modifier and TypeMethodDescriptionbooleanMust be called before callingreadAsync().io.netty.buffer.ByteBufCan only be called is isReadable has returned true.io.netty.buffer.ByteBufReads some data.int<T> voidsetReadHandler(BiConsumer<InputChannel, T> handler, T context) Registers a read handler that will be called when the channel is readable.
-
Method Details
-
readAsync
Can only be called is isReadable has returned true. If there is data this will return a buffer, otherwise it will return null to indicate EOF- Throws:
IOException
-
isReadable
boolean isReadable()Must be called before callingreadAsync(). If this returns true then data can be read, if this returns false then a read handler can be registered usingsetReadHandler(BiConsumer, Object)- Returns:
trueif data can be read
-
setReadHandler
Registers a read handler that will be called when the channel is readable. This handler will only be called once, to continue to read this method must be called every timeisReadable()returns false- Type Parameters:
T- The type of the context object- Parameters:
handler- The handlercontext- A context object that will be passed to the handler
-
readBytesAvailable
int readBytesAvailable()- Returns:
- The number of bytes that are available to be immediately read
-
readBlocking
Reads some data. If all data has been read it will return null.- Returns:
- Throws:
IOException- on failure
-