netty 常用类 5.0.0.Alpha1

简介: 5.0版本较之前有很大改动,如java文件的包名等。 bootstrap io.netty.bootstrap.ServerBootstrap 服务端通道,ServerChannel,的导引。 Bootstrap sub-class which allows easy bootstrap of ServerChannel channel io.netty.channel.Cha

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.
目录
相关文章
|
7月前
|
监控 Java Linux
由浅入深Netty基础知识NIO网络编程1
由浅入深Netty基础知识NIO网络编程
40 0
|
7月前
|
缓存 安全 Java
由浅入深Netty基础知识NIO三大组件原理实战 2
由浅入深Netty基础知识NIO三大组件原理实战
46 0
|
7月前
|
Java
由浅入深Netty基础知识NIO三大组件原理实战 1
由浅入深Netty基础知识NIO三大组件原理实战
60 0
|
2月前
|
移动开发 编解码 网络协议
用Java的BIO和NIO、Netty来实现HTTP服务器(三) 用Netty实现
用Java的BIO和NIO、Netty来实现HTTP服务器(三) 用Netty实现
|
2月前
|
编解码 网络协议 Java
用Java的BIO和NIO、Netty实现HTTP服务器(一) BIO与绪论
用Java的BIO和NIO、Netty实现HTTP服务器(一) BIO与绪论
|
7月前
|
存储 Java Docker
由浅入深Netty基础知识NIO网络编程 2
由浅入深Netty基础知识NIO网络编程
45 0
|
7月前
|
Java Maven Spring
使用netty实现nio web服务器
使用netty实现nio web服务器
59 0
|
3月前
|
设计模式 网络协议 Java
Java NIO 网络编程 | Netty前期知识(二)
Java NIO 网络编程 | Netty前期知识(二)
77 0
|
4月前
|
编解码 网络协议
Netty基础篇:NIO中缓冲区设置太小
Netty基础篇:NIO中缓冲区设置太小
|
4月前
|
存储 缓存 监控
Netty基础篇:详解Netty底层NIO
Netty基础篇:详解Netty底层NIO