public class Session extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
io.netty.buffer.ByteBufAllocator |
alloc()
Return the assigned
ByteBufAllocator which will be used to allocate ByteBufs. |
long |
bytesBeforeUnwritable()
Get how many bytes can be written until
isWritable() returns false. |
long |
bytesBeforeWritable()
Get how many bytes must be drained from underlying buffers until
isWritable() returns true. |
io.netty.channel.Channel |
channel() |
io.netty.channel.ChannelFuture |
close() |
io.netty.channel.ChannelFuture |
close(io.netty.channel.ChannelPromise promise) |
io.netty.channel.ChannelFuture |
closeFuture()
Returns the
ChannelFuture which will be notified when this
channel is closed. |
io.netty.channel.ChannelConfig |
config()
Returns the configuration of this channel.
|
io.netty.channel.Channel |
flush() |
<T> T |
getAttribute(String name) |
io.netty.channel.ChannelId |
id()
Returns the globally unique identifier of this
Channel. |
boolean |
isActive()
Return
true if the Channel is active and so connected. |
boolean |
isOpen()
Returns
true if the Channel is open and may get active later |
boolean |
isRegistered()
Returns
true if the Channel is registered with an EventLoop. |
boolean |
isWritable()
Returns
true if and only if the I/O thread will perform the
requested write operation immediately. |
SocketAddress |
localAddress()
Returns the local address where this channel is bound to.
|
io.netty.channel.ChannelMetadata |
metadata()
Return the
ChannelMetadata of the Channel which describe the nature of the Channel. |
io.netty.channel.ChannelPipeline |
pipeline()
Return the assigned
ChannelPipeline. |
io.netty.channel.Channel |
read() |
SocketAddress |
remoteAddress()
Returns the remote address where this channel is connected to.
|
io.netty.channel.ChannelFuture |
sendBinary(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame binaryWebSocketFrame) |
io.netty.channel.ChannelFuture |
sendBinary(byte[] bytes) |
io.netty.channel.ChannelFuture |
sendBinary(io.netty.buffer.ByteBuf byteBuf) |
io.netty.channel.ChannelFuture |
sendBinary(ByteBuffer byteBuffer) |
io.netty.channel.ChannelFuture |
sendText(io.netty.buffer.ByteBuf byteBuf) |
io.netty.channel.ChannelFuture |
sendText(ByteBuffer byteBuffer) |
io.netty.channel.ChannelFuture |
sendText(String message) |
io.netty.channel.ChannelFuture |
sendText(io.netty.handler.codec.http.websocketx.TextWebSocketFrame textWebSocketFrame) |
<T> void |
setAttribute(String name,
T value) |
void |
setSubprotocols(String subprotocols)
set subprotocols on
BeforeHandshake |
io.netty.channel.Channel.Unsafe |
unsafe()
Returns an internal-use-only object that provides unsafe operations.
|
public void setSubprotocols(String subprotocols)
BeforeHandshakesubprotocols - public io.netty.channel.ChannelFuture sendText(String message)
public io.netty.channel.ChannelFuture sendText(io.netty.buffer.ByteBuf byteBuf)
public io.netty.channel.ChannelFuture sendText(ByteBuffer byteBuffer)
public io.netty.channel.ChannelFuture sendText(io.netty.handler.codec.http.websocketx.TextWebSocketFrame textWebSocketFrame)
public io.netty.channel.ChannelFuture sendBinary(byte[] bytes)
public io.netty.channel.ChannelFuture sendBinary(io.netty.buffer.ByteBuf byteBuf)
public io.netty.channel.ChannelFuture sendBinary(ByteBuffer byteBuffer)
public io.netty.channel.ChannelFuture sendBinary(io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame binaryWebSocketFrame)
public <T> void setAttribute(String name, T value)
public <T> T getAttribute(String name)
public io.netty.channel.Channel channel()
public io.netty.channel.ChannelId id()
Channel.public io.netty.channel.ChannelConfig config()
public boolean isOpen()
true if the Channel is open and may get active laterpublic boolean isRegistered()
true if the Channel is registered with an EventLoop.public boolean isActive()
true if the Channel is active and so connected.public io.netty.channel.ChannelMetadata metadata()
ChannelMetadata of the Channel which describe the nature of the Channel.public SocketAddress localAddress()
SocketAddress is supposed to be down-cast into more concrete
type such as InetSocketAddress to retrieve the detailed
information.null if this channel is not bound.public SocketAddress remoteAddress()
SocketAddress is supposed to be down-cast into more
concrete type such as InetSocketAddress to retrieve the detailed
information.null if this channel is not connected.
If this channel is not connected but it can receive messages
from arbitrary remote addresses (e.g. DatagramChannel,
use DefaultAddressedEnvelope.recipient() to determine
the origination of the received message as this method will
return null.public io.netty.channel.ChannelFuture closeFuture()
ChannelFuture which will be notified when this
channel is closed. This method always returns the same future instance.public boolean isWritable()
true if and only if the I/O thread will perform the
requested write operation immediately. Any write requests made when
this method returns false are queued until the I/O thread is
ready to process the queued write requests.public long bytesBeforeUnwritable()
isWritable() returns false.
This quantity will always be non-negative. If isWritable() is false then 0.public long bytesBeforeWritable()
isWritable() returns true.
This quantity will always be non-negative. If isWritable() is true then 0.public io.netty.channel.Channel.Unsafe unsafe()
public io.netty.channel.ChannelPipeline pipeline()
ChannelPipeline.public io.netty.buffer.ByteBufAllocator alloc()
ByteBufAllocator which will be used to allocate ByteBufs.public io.netty.channel.Channel read()
public io.netty.channel.Channel flush()
public io.netty.channel.ChannelFuture close()
public io.netty.channel.ChannelFuture close(io.netty.channel.ChannelPromise promise)
Copyright © 2021. All rights reserved.