netty 常用类 5.0.0.Alpha1

来源:互联网 发布:js中substring源码 编辑:程序博客网 时间:2024/04/30 13:27

5.0版本较之前有很大改动,如java文件的包名等。

bootstrap

io.netty.bootstrap.ServerBootstrap
服务端通道,ServerChannel,的导引。
Bootstrap sub-class which allows easy bootstrap of ServerChannel

channel

io.netty.channel.ChannelFuture
通道,Channel,异步IO操作的结果。
The result of an asynchronous Channel I/O operation. 

io.netty.channel.ChannelInitializer
一个特殊的通道处理器,一旦一个Channel被注册到了它的EventLoop,ChannelInitializer用于初始化Channel。
A special ChannelHandler which offers an easy way to initialize a Channel once it was registered to its EventLoop.

Open Declaration io.netty.channel.ChannelOption
用于配置一个通道配置,ChannelConfig。
A ChannelOption allows to configure a ChannelConfig in a type-safe way. 


io.netty.channel.socket.SocketChannel
TCP 套接字的Channel。
A TCP/IP socket Channel.

io.netty.channel.EventLoopGroup
EventExecutorGroup的具体类。允许在时间循环中注册选择器。
Special EventExecutorGroup which allows to register Channel's that get processed for later selection during the event loop.

ChannelPipeline io.netty.channel.Channel.pipeline()
返回已分配的管道,ChannelPipeline。
Return the assigned ChannelPipeline

ChannelPipeline io.netty.channel.ChannelPipeline.addLast(ChannelHandler... handlers)
在管道末尾插入一个通道处理器,ChannelHandler。
Inserts a ChannelHandlers at the last position of this pipeline.

io.netty.channel.ChannelHandler
通道处理器,用于处理一个IO事件或者拦截一个IO操作。
Handles an I/O event or intercepts an I/O operation, and forwards it to its next handler in its ChannelPipeline. 

io.netty.channel.ChannelHandlerAdapter
一个通道处理器,ChannelHandler,的实现。
Skelton implementation of a ChannelHandler.

channel.ChannelHandlerContext

ChannelFuture io.netty.channel.ChannelHandlerContext.write(Object msg)
通过对应的 管道,ChannelPipeline,写消息。此方法不会进行冲洗,flush,所以你需要自己调用。
Request to write a message via this ChannelHandlerContext through the ChannelPipeline. This method will not request to actual flush, so be sure to call flush() once you want to request to flush all pending data to the actual transport.

buffer

io.netty.buffer.Unpooled
通过申请新的内存来创建一个新的字节缓冲。
Creates a new ByteBuf by allocating new space or by wrapping or copying existing byte arrays, byte buffers and a string. 

ByteBuf io.netty.buffer.Unpooled.copiedBuffer(byte[] array)
返回一个新的字节缓冲,内容是指定的array参数。
Creates a new big-endian buffer whose content is a copy of the specified array. The new buffer's readerIndex and writerIndex are 0 and array.length respectively.
1 0
原创粉丝点击