Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
netty-demo
提交
0995889f
N
netty-demo
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
netty-demo
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
netty-demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0995889f
编写于
4月 27, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:分类
上级
007e4230
变更
97
隐藏空白更改
内联
并排
Showing
97 changed file
with
101 addition
and
282 deletion
+101
-282
netty-01-nio/src/main/java/com/kwan/shuyu/netty/Server.java
netty-01-nio/src/main/java/com/kwan/shuyu/netty/Server.java
+0
-48
netty-01-nio/src/main/java/com/kwan/shuyu/netty/TestNetty.java
...-01-nio/src/main/java/com/kwan/shuyu/netty/TestNetty.java
+0
-7
netty-01-nio/src/main/java/com/kwan/shuyu/netty/handler/EchoHandler.java
...c/main/java/com/kwan/shuyu/netty/handler/EchoHandler.java
+0
-14
netty-01-nio/src/main/java/com/kwan/shuyu/netty/handler/IProtocalHandler.java
...n/java/com/kwan/shuyu/netty/handler/IProtocalHandler.java
+0
-36
netty-01-nio/src/main/java/com/kwan/shuyu/netty/handler/PrintInboundHandler.java
...ava/com/kwan/shuyu/netty/handler/PrintInboundHandler.java
+0
-74
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_01_Test_FileChannel.java
...u/netty_01_bytebuffer/ByteBuffer_01_Test_FileChannel.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_02_Test_hasRemaining.java
.../netty_01_bytebuffer/ByteBuffer_02_Test_hasRemaining.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_03_Test_put.java
...wan/shuyu/netty_01_bytebuffer/ByteBuffer_03_Test_put.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_04_Test_flip.java
...an/shuyu/netty_01_bytebuffer/ByteBuffer_04_Test_flip.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_05_Test_compact.java
...shuyu/netty_01_bytebuffer/ByteBuffer_05_Test_compact.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_06_Test_allocate.java
...huyu/netty_01_bytebuffer/ByteBuffer_06_Test_allocate.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_07_Test_read.java
...an/shuyu/netty_01_bytebuffer/ByteBuffer_07_Test_read.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_08_Test_mark.java
...an/shuyu/netty_01_bytebuffer/ByteBuffer_08_Test_mark.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_09_Test_get.java
...wan/shuyu/netty_01_bytebuffer/ByteBuffer_09_Test_get.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_10_Test_String.java
.../shuyu/netty_01_bytebuffer/ByteBuffer_10_Test_String.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_11_Test_Read.java
...an/shuyu/netty_01_bytebuffer/ByteBuffer_11_Test_Read.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_12_Test_Write.java
...n/shuyu/netty_01_bytebuffer/ByteBuffer_12_Test_Write.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_13_Test_split.java
...n/shuyu/netty_01_bytebuffer/ByteBuffer_13_Test_split.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_01_Test_exists.java
...ava/com/kwan/shuyu/netty_02_file/File_01_Test_exists.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_02_Test_create.java
...ava/com/kwan/shuyu/netty_02_file/File_02_Test_create.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_03_Test_create_more.java
...om/kwan/shuyu/netty_02_file/File_03_Test_create_more.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_04_Test_transferTo.java
...com/kwan/shuyu/netty_02_file/File_04_Test_transferTo.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_05_Test_transferTo.java
...com/kwan/shuyu/netty_02_file/File_05_Test_transferTo.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_06_Test_copy.java
.../java/com/kwan/shuyu/netty_02_file/File_06_Test_copy.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_07_Test_walkFileTree.java
...m/kwan/shuyu/netty_02_file/File_07_Test_walkFileTree.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_08_Test_jar.java
...n/java/com/kwan/shuyu/netty_02_file/File_08_Test_jar.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_09_Test_delete.java
...ava/com/kwan/shuyu/netty_02_file/File_09_Test_delete.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_10_Test_copy.java
.../java/com/kwan/shuyu/netty_02_file/File_10_Test_copy.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c1_阻塞/NioClient.java
...ain/java/com/kwan/shuyu/netty_03_nio/c1_阻塞/NioClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c1_阻塞/NioServer.java
...ain/java/com/kwan/shuyu/netty_03_nio/c1_阻塞/NioServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c2_非阻塞/NioClient.java
...in/java/com/kwan/shuyu/netty_03_nio/c2_非阻塞/NioClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c2_非阻塞/NioServer.java
...in/java/com/kwan/shuyu/netty_03_nio/c2_非阻塞/NioServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c3_Selector/NioClient.java
...va/com/kwan/shuyu/netty_03_nio/c3_Selector/NioClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c3_Selector/NioServer.java
...va/com/kwan/shuyu/netty_03_nio/c3_Selector/NioServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c4_attachment/NioClient.java
.../com/kwan/shuyu/netty_03_nio/c4_attachment/NioClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c4_attachment/NioServer.java
.../com/kwan/shuyu/netty_03_nio/c4_attachment/NioServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c5_attach/NioClient.java
...java/com/kwan/shuyu/netty_03_nio/c5_attach/NioClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c5_attach/NioServer.java
...java/com/kwan/shuyu/netty_03_nio/c5_attach/NioServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c6_write/NioClient.java
.../java/com/kwan/shuyu/netty_03_nio/c6_write/NioClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c6_write/NioServer.java
.../java/com/kwan/shuyu/netty_03_nio/c6_write/NioServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/NioClient.java
...om/kwan/shuyu/netty_03_nio/c7_optimization/NioClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/NioServer.java
...om/kwan/shuyu/netty_03_nio/c7_optimization/NioServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/Worker.java
...a/com/kwan/shuyu/netty_03_nio/c7_optimization/Worker.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/Worker2.java
.../com/kwan/shuyu/netty_03_nio/c7_optimization/Worker2.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c8_aio/AioFileChannel.java
...va/com/kwan/shuyu/netty_03_nio/c8_aio/AioFileChannel.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c10_listener/TestEventLoop_01_server.java
.../netty_04_netty/c10_listener/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c10_listener/TestEventLoop_02_client.java
.../netty_04_netty/c10_listener/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c11_Scanner/TestEventLoop_01_server.java
...u/netty_04_netty/c11_Scanner/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c11_Scanner/TestEventLoop_02_client.java
...u/netty_04_netty/c11_Scanner/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c12_closesync/TestEventLoop_01_server.java
...netty_04_netty/c12_closesync/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c12_closesync/TestEventLoop_02_client.java
...netty_04_netty/c12_closesync/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c13_closefeature/TestEventLoop_01_server.java
...ty_04_netty/c13_closefeature/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c13_closefeature/TestEventLoop_02_client.java
...ty_04_netty/c13_closefeature/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c1_basic/HelloClient.java
...a/com/kwan/shuyu/netty_04_netty/c1_basic/HelloClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c1_basic/HelloServer.java
...a/com/kwan/shuyu/netty_04_netty/c1_basic/HelloServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c2_ByteBuf/TestEventLoop_01_Client.java
...yu/netty_04_netty/c2_ByteBuf/TestEventLoop_01_Client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c2_ByteBuf/TestEventLoop_02_server.java
...yu/netty_04_netty/c2_ByteBuf/TestEventLoop_02_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c3_fireChannelRead/TestEventLoop_01_Client.java
..._04_netty/c3_fireChannelRead/TestEventLoop_01_Client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c3_fireChannelRead/TestEventLoop_02_client.java
..._04_netty/c3_fireChannelRead/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c4_EventLoopGroup/TestEventLoop_01_EventLoopGroup.java
...ty/c4_EventLoopGroup/TestEventLoop_01_EventLoopGroup.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c4_EventLoopGroup/TestEventLoop_02_submit.java
...y_04_netty/c4_EventLoopGroup/TestEventLoop_02_submit.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c5_schedule/TestEventLoop_03_scheduleAtFixedRate.java
...tty/c5_schedule/TestEventLoop_03_scheduleAtFixedRate.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c6_codec/TestEventLoop_01_server.java
...huyu/netty_04_netty/c6_codec/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c6_codec/TestEventLoop_02_client.java
...huyu/netty_04_netty/c6_codec/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c7_channel/TestEventLoop_01_server.java
...yu/netty_04_netty/c7_channel/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c7_channel/TestEventLoop_02_Client.java
...yu/netty_04_netty/c7_channel/TestEventLoop_02_Client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c8_log/TestEventLoop_01_server.java
.../shuyu/netty_04_netty/c8_log/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c8_log/TestEventLoop_02_client.java
.../shuyu/netty_04_netty/c8_log/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c9_sync/TestEventLoop_01_server.java
...shuyu/netty_04_netty/c9_sync/TestEventLoop_01_server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c9_sync/TestEventLoop_02_client.java
...shuyu/netty_04_netty/c9_sync/TestEventLoop_02_client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestJdkFuture.java
...in/java/com/kwan/shuyu/netty_05_future/TestJdkFuture.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyFuture.java
.../java/com/kwan/shuyu/netty_05_future/TestNettyFuture.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyFutureListener.java
...m/kwan/shuyu/netty_05_future/TestNettyFutureListener.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyPromiseFailure.java
...m/kwan/shuyu/netty_05_future/TestNettyPromiseFailure.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyPromiseSuccess.java
...m/kwan/shuyu/netty_05_future/TestNettyPromiseSuccess.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/Client.java
...rc/main/java/com/kwan/shuyu/netty_06_pipeline/Client.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/Server.java
...rc/main/java/com/kwan/shuyu/netty_06_pipeline/Server.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/Student.java
...c/main/java/com/kwan/shuyu/netty_06_pipeline/Student.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/TestEmbeddedChannel.java
...com/kwan/shuyu/netty_06_pipeline/TestEmbeddedChannel.java
+6
-6
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_01.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_01.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_02.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_02.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_03.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_03.java
+4
-4
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_04.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_04.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_05.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_05.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_06.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_06.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_07.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_07.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_08.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_08.java
+3
-3
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_09.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_09.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_10.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_10.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_11.java
...main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_11.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_08_socket/TestClient.java
.../main/java/com/kwan/shuyu/netty_08_socket/TestClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_08_socket/TestServer.java
.../main/java/com/kwan/shuyu/netty_08_socket/TestServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_09_io/BIOServer.java
...o/src/main/java/com/kwan/shuyu/netty_09_io/BIOServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_09_io/NIOServer.java
...o/src/main/java/com/kwan/shuyu/netty_09_io/NIOServer.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_09_io/OIOClient.java
...o/src/main/java/com/kwan/shuyu/netty_09_io/OIOClient.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/netty_09_io/Reactor.java
...nio/src/main/java/com/kwan/shuyu/netty_09_io/Reactor.java
+1
-1
netty-01-nio/src/main/java/com/kwan/shuyu/until/ByteBufferUtil.java
...io/src/main/java/com/kwan/shuyu/until/ByteBufferUtil.java
+0
-2
未找到文件。
netty-01-nio/src/main/java/com/kwan/shuyu/netty/Server.java
已删除
100644 → 0
浏览文件 @
007e4230
package
com.kwan.shuyu.netty
;
import
com.kwan.shuyu.netty.handler.IProtocalHandler
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.channel.Channel
;
import
io.netty.channel.ChannelFuture
;
import
io.netty.channel.ChannelInitializer
;
import
io.netty.channel.EventLoopGroup
;
import
io.netty.channel.nio.NioEventLoopGroup
;
import
io.netty.channel.socket.nio.NioServerSocketChannel
;
import
io.netty.handler.codec.LengthFieldBasedFrameDecoder
;
import
io.netty.handler.codec.string.StringEncoder
;
import
io.netty.util.CharsetUtil
;
import
io.netty.util.concurrent.DefaultEventExecutorGroup
;
public
class
Server
{
private
static
void
start
(
int
port
)
throws
InterruptedException
{
EventLoopGroup
bossGroup
=
new
NioEventLoopGroup
();
EventLoopGroup
workerGroup
=
new
NioEventLoopGroup
();
try
{
ServerBootstrap
b
=
new
ServerBootstrap
();
//Bootstrap for client
b
.
group
(
bossGroup
,
workerGroup
);
b
.
channel
(
NioServerSocketChannel
.
class
);
//always
b
.
childHandler
(
new
ChannelInitializer
()
{
@Override
protected
void
initChannel
(
Channel
ch
)
throws
Exception
{
//ch.pipeline().addLast(new PrintInboundHandler("id1"));
// ch.pipeline().addLast(new LineBasedFrameDecoder(80,false,false));
// ch.pipeline().addLast(new StringDecoder());
// ch.pipeline().addLast(new EchoHandler());
ch
.
pipeline
().
addLast
(
new
LengthFieldBasedFrameDecoder
(
1024
,
2
,
2
,
-
2
,
0
));
ch
.
pipeline
().
addLast
(
new
DefaultEventExecutorGroup
(
16
),
new
IProtocalHandler
());
ch
.
pipeline
().
addLast
(
new
StringEncoder
(
CharsetUtil
.
UTF_8
));
}
});
ChannelFuture
f
=
b
.
bind
(
port
).
sync
();
f
.
channel
().
closeFuture
().
sync
();
}
finally
{
bossGroup
.
shutdownGracefully
();
workerGroup
.
shutdownGracefully
();
}
}
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
start
(
8084
);
}
}
\ No newline at end of file
netty-01-nio/src/main/java/com/kwan/shuyu/netty/TestNetty.java
已删除
100644 → 0
浏览文件 @
007e4230
package
com.kwan.shuyu.netty
;
public
class
TestNetty
{
public
static
void
main
(
String
[]
args
)
{
}
}
netty-01-nio/src/main/java/com/kwan/shuyu/netty/handler/EchoHandler.java
已删除
100644 → 0
浏览文件 @
007e4230
package
com.kwan.shuyu.netty.handler
;
import
io.netty.channel.ChannelHandlerContext
;
import
io.netty.channel.ChannelInboundHandlerAdapter
;
public
class
EchoHandler
extends
ChannelInboundHandlerAdapter
{
@Override
public
void
channelRead
(
ChannelHandlerContext
ctx
,
Object
msg
)
{
String
in
=
(
String
)
msg
;
ctx
.
channel
().
writeAndFlush
(
in
);
}
}
netty-01-nio/src/main/java/com/kwan/shuyu/netty/handler/IProtocalHandler.java
已删除
100644 → 0
浏览文件 @
007e4230
package
com.kwan.shuyu.netty.handler
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.channel.ChannelHandlerContext
;
import
io.netty.channel.ChannelInboundHandlerAdapter
;
import
io.netty.util.CharsetUtil
;
import
java.util.Random
;
public
class
IProtocalHandler
extends
ChannelInboundHandlerAdapter
{
@Override
public
void
channelRead
(
ChannelHandlerContext
ctx
,
final
Object
msg
)
throws
Exception
{
int
sleep
=
500
*
new
Random
().
nextInt
(
5
);
System
.
out
.
println
(
"sleep:"
+
sleep
);
Thread
.
sleep
(
sleep
);
final
ByteBuf
buf
=
(
ByteBuf
)
msg
;
char
c1
=
(
char
)
buf
.
readByte
();
char
c2
=
(
char
)
buf
.
readByte
();
if
(
c1
!=
'J'
||
c2
!=
'W'
)
{
ctx
.
fireExceptionCaught
(
new
Exception
(
"magic error"
));
return
;
}
buf
.
readShort
();
//skip length
String
outputStr
=
buf
.
toString
(
CharsetUtil
.
UTF_8
);
System
.
out
.
println
(
outputStr
);
ctx
.
channel
().
writeAndFlush
(
outputStr
+
"\n"
);
}
}
netty-01-nio/src/main/java/com/kwan/shuyu/netty/handler/PrintInboundHandler.java
已删除
100644 → 0
浏览文件 @
007e4230
package
com.kwan.shuyu.netty.handler
;
import
io.netty.channel.ChannelHandlerContext
;
import
io.netty.channel.ChannelInboundHandler
;
public
class
PrintInboundHandler
implements
ChannelInboundHandler
{
private
final
String
id
;
public
PrintInboundHandler
(
String
id
)
{
this
.
id
=
id
;
}
@Override
public
void
handlerAdded
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"handlerAdded "
+
id
);
}
@Override
public
void
handlerRemoved
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"handlerRemoved "
+
id
);
}
@Override
public
void
channelRegistered
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"channelRegistered "
+
id
);
ctx
.
fireChannelRegistered
();
}
@Override
public
void
channelUnregistered
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"channelUnregistered "
+
id
);
ctx
.
fireChannelUnregistered
();
}
@Override
public
void
channelActive
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"channelActive "
+
id
);
ctx
.
fireChannelActive
();
}
@Override
public
void
channelInactive
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"channelInactive "
+
id
);
ctx
.
fireChannelInactive
();
}
@Override
public
void
channelRead
(
ChannelHandlerContext
ctx
,
Object
msg
)
throws
Exception
{
System
.
out
.
println
(
"channelRead "
+
id
);
ctx
.
fireChannelRead
(
msg
);
//ctx.channel().pipeline().fireChannelRead(msg);
}
@Override
public
void
channelReadComplete
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"channelReadComplete "
+
id
);
ctx
.
fireChannelReadComplete
();
}
@Override
public
void
userEventTriggered
(
ChannelHandlerContext
ctx
,
Object
evt
)
throws
Exception
{
System
.
out
.
println
(
"userEventTriggered "
+
id
);
}
@Override
public
void
channelWritabilityChanged
(
ChannelHandlerContext
ctx
)
throws
Exception
{
System
.
out
.
println
(
"channelWritabilityChanged "
+
id
);
}
@Override
public
void
exceptionCaught
(
ChannelHandlerContext
ctx
,
Throwable
cause
)
throws
Exception
{
System
.
out
.
println
(
"exceptionCaught "
+
id
);
}
}
\ No newline at end of file
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_01_Test_FileChannel.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_01_Test_FileChannel.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
java.io.FileInputStream
;
import
java.nio.ByteBuffer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_02_Test_hasRemaining.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_02_Test_hasRemaining.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_03_Test_put.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_03_Test_put.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_04_Test_flip.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_04_Test_flip.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_05_Test_compact.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_05_Test_compact.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_06_Test_allocate.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_06_Test_allocate.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_07_Test_read.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_07_Test_read.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_08_Test_mark.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_08_Test_mark.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_09_Test_get.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_09_Test_get.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_10_Test_String.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_10_Test_String.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_11_Test_Read.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_11_Test_Read.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_12_Test_Write.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_12_Test_Write.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
java.io.RandomAccessFile
;
import
java.nio.ByteBuffer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_01_bytebuffer/ByteBuffer_13_Test_split.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_01_bytebuffer/ByteBuffer_13_Test_split.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_01_bytebuffer
;
package
com.kwan.shuyu.netty_01_bytebuffer
;
import
java.nio.ByteBuffer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_01_Test_exists.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_01_Test_exists.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_02_Test_create.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_02_Test_create.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.IOException
;
import
java.nio.file.Files
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_03_Test_create_more.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_03_Test_create_more.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.IOException
;
import
java.nio.file.Files
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_04_Test_transferTo.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_04_Test_transferTo.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_05_Test_transferTo.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_05_Test_transferTo.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_06_Test_copy.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_06_Test_copy.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.IOException
;
import
java.nio.file.Files
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_07_Test_walkFileTree.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_07_Test_walkFileTree.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.IOException
;
import
java.nio.file.*
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_08_Test_jar.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_08_Test_jar.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.IOException
;
import
java.nio.file.*
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_09_Test_delete.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_09_Test_delete.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.IOException
;
import
java.nio.file.*
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_02_file/File_10_Test_copy.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_02_file/File_10_Test_copy.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_02_file
;
package
com.kwan.shuyu.netty_02_file
;
import
java.io.IOException
;
import
java.nio.file.Files
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c1_阻塞/NioClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c1_阻塞/NioClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c1_
阻塞
;
package
com.kwan.shuyu.netty_03_nio.c1_
阻塞
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c1_阻塞/NioServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c1_阻塞/NioServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c1_
阻塞
;
package
com.kwan.shuyu.netty_03_nio.c1_
阻塞
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/netty_03_nio/c3_Selector
/NioClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_03_nio/c2_非阻塞
/NioClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.netty_03_nio.c3_Selector
;
package
com.kwan.shuyu.
netty_03_nio.c2_
非阻塞
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c2_非阻塞/NioServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c2_非阻塞/NioServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c2_
非阻塞
;
package
com.kwan.shuyu.netty_03_nio.c2_
非阻塞
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/netty_03_nio/c2_非阻塞
/NioClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_03_nio/c3_Selector
/NioClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.netty_03_nio.c2_
非阻塞
;
package
com.kwan.shuyu.
netty_03_nio.c3_Selector
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c3_Selector/NioServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c3_Selector/NioServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c3_Selector
;
package
com.kwan.shuyu.netty_03_nio.c3_Selector
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c4_attachment/NioClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c4_attachment/NioClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c4_attachment
;
package
com.kwan.shuyu.netty_03_nio.c4_attachment
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c4_attachment/NioServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c4_attachment/NioServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c4_attachment
;
package
com.kwan.shuyu.netty_03_nio.c4_attachment
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c5_attach/NioClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c5_attach/NioClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c5_attach
;
package
com.kwan.shuyu.netty_03_nio.c5_attach
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c5_attach/NioServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c5_attach/NioServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c5_attach
;
package
com.kwan.shuyu.netty_03_nio.c5_attach
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c6_write/NioClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c6_write/NioClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c6_write
;
package
com.kwan.shuyu.netty_03_nio.c6_write
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c6_write/NioServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c6_write/NioServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c6_write
;
package
com.kwan.shuyu.netty_03_nio.c6_write
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c7_optimization/NioClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/NioClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c7_optimization
;
package
com.kwan.shuyu.netty_03_nio.c7_optimization
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c7_optimization/NioServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/NioServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c7_optimization
;
package
com.kwan.shuyu.netty_03_nio.c7_optimization
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c7_optimization/Worker.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/Worker.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c7_optimization
;
package
com.kwan.shuyu.netty_03_nio.c7_optimization
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c7_optimization/Worker2.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c7_optimization/Worker2.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c7_optimization
;
package
com.kwan.shuyu.netty_03_nio.c7_optimization
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_03_nio/c8_aio/AioFileChannel.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_03_nio/c8_aio/AioFileChannel.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_03_nio.c8_aio
;
package
com.kwan.shuyu.netty_03_nio.c8_aio
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c10_listener/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c10_listener/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c10_listener
;
package
com.kwan.shuyu.netty_04_netty.c10_listener
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c10_listener/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c10_listener/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c10_listener
;
package
com.kwan.shuyu.netty_04_netty.c10_listener
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c11_Scanner/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c11_Scanner/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c11_Scanner
;
package
com.kwan.shuyu.netty_04_netty.c11_Scanner
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c11_Scanner/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c11_Scanner/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c11_Scanner
;
package
com.kwan.shuyu.netty_04_netty.c11_Scanner
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c12_closesync/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c12_closesync/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c12_closesync
;
package
com.kwan.shuyu.netty_04_netty.c12_closesync
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c12_closesync/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c12_closesync/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c12_closesync
;
package
com.kwan.shuyu.netty_04_netty.c12_closesync
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c13_closefeature/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c13_closefeature/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c13_closefeature
;
package
com.kwan.shuyu.netty_04_netty.c13_closefeature
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c13_closefeature/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c13_closefeature/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c13_closefeature
;
package
com.kwan.shuyu.netty_04_netty.c13_closefeature
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c1_basic/HelloClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c1_basic/HelloClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c1_basic
;
package
com.kwan.shuyu.netty_04_netty.c1_basic
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.ChannelInitializer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c1_basic/HelloServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c1_basic/HelloServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c1_basic
;
package
com.kwan.shuyu.netty_04_netty.c1_basic
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.channel.ChannelHandlerContext
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c2_ByteBuf/TestEventLoop_01_Client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c2_ByteBuf/TestEventLoop_01_Client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c2_ByteBuf
;
package
com.kwan.shuyu.netty_04_netty.c2_ByteBuf
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.ChannelInitializer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c2_ByteBuf/TestEventLoop_02_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c2_ByteBuf/TestEventLoop_02_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c2_ByteBuf
;
package
com.kwan.shuyu.netty_04_netty.c2_ByteBuf
;
import
io.netty.bootstrap.ServerBootstrap
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c3_fireChannelRead/TestEventLoop_01_Client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c3_fireChannelRead/TestEventLoop_01_Client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c3_fireChannelRead
;
package
com.kwan.shuyu.netty_04_netty.c3_fireChannelRead
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.ChannelInitializer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c3_fireChannelRead/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c3_fireChannelRead/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c3_fireChannelRead
;
package
com.kwan.shuyu.netty_04_netty.c3_fireChannelRead
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c4_EventLoopGroup/TestEventLoop_01_EventLoopGroup.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c4_EventLoopGroup/TestEventLoop_01_EventLoopGroup.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c4_EventLoopGroup
;
package
com.kwan.shuyu.netty_04_netty.c4_EventLoopGroup
;
import
io.netty.channel.DefaultEventLoopGroup
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c4_EventLoopGroup/TestEventLoop_02_submit.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c4_EventLoopGroup/TestEventLoop_02_submit.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c4_EventLoopGroup
;
package
com.kwan.shuyu.netty_04_netty.c4_EventLoopGroup
;
import
io.netty.channel.DefaultEventLoopGroup
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c5_schedule/TestEventLoop_03_scheduleAtFixedRate.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c5_schedule/TestEventLoop_03_scheduleAtFixedRate.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c5_schedule
;
package
com.kwan.shuyu.netty_04_netty.c5_schedule
;
import
io.netty.channel.EventLoopGroup
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c6_codec/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c6_codec/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c6_codec
;
package
com.kwan.shuyu.netty_04_netty.c6_codec
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.channel.ChannelInitializer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c6_codec/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c6_codec/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c6_codec
;
package
com.kwan.shuyu.netty_04_netty.c6_codec
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/netty_04_netty/c9_sync
/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_04_netty/c7_channel
/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.netty_04_netty.c9_sync
;
package
com.kwan.shuyu.
netty_04_netty.c7_channel
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c7_channel/TestEventLoop_02_Client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c7_channel/TestEventLoop_02_Client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c7_channel
;
package
com.kwan.shuyu.netty_04_netty.c7_channel
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c8_log/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c8_log/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c8_log
;
package
com.kwan.shuyu.netty_04_netty.c8_log
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c8_log/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c8_log/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c8_log
;
package
com.kwan.shuyu.netty_04_netty.c8_log
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/netty_04_netty/c7_channel
/TestEventLoop_01_server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_04_netty/c9_sync
/TestEventLoop_01_server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.netty_04_netty.c7_channel
;
package
com.kwan.shuyu.
netty_04_netty.c9_sync
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_04_netty/c9_sync/TestEventLoop_02_client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_04_netty/c9_sync/TestEventLoop_02_client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_04_netty.c9_sync
;
package
com.kwan.shuyu.netty_04_netty.c9_sync
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.Channel
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_05_future/TestJdkFuture.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestJdkFuture.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_05_future
;
package
com.kwan.shuyu.netty_05_future
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_05_future/TestNettyFuture.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyFuture.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_05_future
;
package
com.kwan.shuyu.netty_05_future
;
import
io.netty.channel.EventLoop
;
import
io.netty.channel.nio.NioEventLoopGroup
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_05_future/TestNettyFutureListener.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyFutureListener.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_05_future
;
package
com.kwan.shuyu.netty_05_future
;
import
io.netty.channel.EventLoop
;
import
io.netty.channel.nio.NioEventLoopGroup
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_05_future/TestNettyPromiseFailure.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyPromiseFailure.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_05_future
;
package
com.kwan.shuyu.netty_05_future
;
import
io.netty.channel.EventLoop
;
import
io.netty.channel.nio.NioEventLoopGroup
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_05_future/TestNettyPromiseSuccess.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_05_future/TestNettyPromiseSuccess.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_05_future
;
package
com.kwan.shuyu.netty_05_future
;
import
io.netty.channel.EventLoop
;
import
io.netty.channel.nio.NioEventLoopGroup
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_06_pipeline/Client.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/Client.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_06_pipeline
;
package
com.kwan.shuyu.netty_06_pipeline
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.channel.ChannelInitializer
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_06_pipeline/Server.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/Server.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_06_pipeline
;
package
com.kwan.shuyu.netty_06_pipeline
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.ByteBuf
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_06_pipeline/Student.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/Student.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_06_pipeline
;
package
com.kwan.shuyu.netty_06_pipeline
;
import
lombok.Data
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_06_pipeline/TestEmbeddedChannel.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_06_pipeline/TestEmbeddedChannel.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_06_pipeline
;
package
com.kwan.shuyu.netty_06_pipeline
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
@@ -69,11 +69,11 @@ public class TestEmbeddedChannel {
/**
* 输出结果
* [main] INFO com.kwan.shuyu.
heima.
netty_06_pipeline.TestEmbeddedChannel - 1
* [main] INFO com.kwan.shuyu.
heima.
netty_06_pipeline.TestEmbeddedChannel - 2
* [main] INFO com.kwan.shuyu.
heima.
netty_06_pipeline.TestEmbeddedChannel - 3333333333333333
* [main] INFO com.kwan.shuyu.
heima.
netty_06_pipeline.TestEmbeddedChannel - 5
* [main] INFO com.kwan.shuyu.
heima.
netty_06_pipeline.TestEmbeddedChannel - 4
* [main] INFO com.kwan.shuyu.netty_06_pipeline.TestEmbeddedChannel - 1
* [main] INFO com.kwan.shuyu.netty_06_pipeline.TestEmbeddedChannel - 2
* [main] INFO com.kwan.shuyu.netty_06_pipeline.TestEmbeddedChannel - 3333333333333333
* [main] INFO com.kwan.shuyu.netty_06_pipeline.TestEmbeddedChannel - 5
* [main] INFO com.kwan.shuyu.netty_06_pipeline.TestEmbeddedChannel - 4
* hello
*/
}
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_01.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_01.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_02.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_02.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_03.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_03.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
@@ -27,9 +27,9 @@ public class ByteBuf_03 {
log
(
buffer
);
//上面代码创建了一个默认的ByteBuf(池化基于直接内存的 ByteBuf),初始容量是10
/**
[main] INFO com.kwan.shuyu.
heima.
netty_07_bytebuf.ByteBuf_03 - PooledUnsafeDirectByteBuf
[main] INFO com.kwan.shuyu.
heima.
netty_07_bytebuf.ByteBuf_03 - PooledUnsafeHeapByteBuf
[main] INFO com.kwan.shuyu.
heima.
netty_07_bytebuf.ByteBuf_03 - PooledUnsafeDirectByteBuf
[main] INFO com.kwan.shuyu.netty_07_bytebuf.ByteBuf_03 - PooledUnsafeDirectByteBuf
[main] INFO com.kwan.shuyu.netty_07_bytebuf.ByteBuf_03 - PooledUnsafeHeapByteBuf
[main] INFO com.kwan.shuyu.netty_07_bytebuf.ByteBuf_03 - PooledUnsafeDirectByteBuf
read index:0 write index:0 capacity:10
*/
}
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_04.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_04.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_05.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_05.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_06.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_06.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_07.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_07.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_08.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_08.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
@@ -79,8 +79,8 @@ public class ByteBuf_08 {
* at io.netty.buffer.ByteBufUtil$HexUtil.access$500(ByteBufUtil.java:1420)
* at io.netty.buffer.ByteBufUtil.appendPrettyHexDump(ByteBufUtil.java:1416)
* at io.netty.buffer.ByteBufUtil.appendPrettyHexDump(ByteBufUtil.java:1407)
* at com.kwan.shuyu.
heima.
netty_07_bytebuf.ByteBuf_08.log(ByteBuf_08.java:79)
* at com.kwan.shuyu.
heima.
netty_07_bytebuf.ByteBuf_08.main(ByteBuf_08.java:67)
* at com.kwan.shuyu.netty_07_bytebuf.ByteBuf_08.log(ByteBuf_08.java:79)
* at com.kwan.shuyu.netty_07_bytebuf.ByteBuf_08.main(ByteBuf_08.java:67)
*/
}
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_09.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_09.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_10.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_10.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.ByteBufAllocator
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_07_bytebuf/ByteBuf_11.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_07_bytebuf/ByteBuf_11.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_07_bytebuf
;
package
com.kwan.shuyu.netty_07_bytebuf
;
import
io.netty.buffer.*
;
import
lombok.extern.slf4j.Slf4j
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_08_socket/TestClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_08_socket/TestClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_08_socket
;
package
com.kwan.shuyu.netty_08_socket
;
import
java.io.*
;
import
java.net.Socket
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
heima/
netty_08_socket/TestServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/netty_08_socket/TestServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
heima.
netty_08_socket
;
package
com.kwan.shuyu.netty_08_socket
;
import
java.io.*
;
import
java.net.ServerSocket
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
old
/BIOServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_09_io
/BIOServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
old
;
package
com.kwan.shuyu.
netty_09_io
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
old
/NIOServer.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_09_io
/NIOServer.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
old
;
package
com.kwan.shuyu.
netty_09_io
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
old
/OIOClient.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_09_io
/OIOClient.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
old
;
package
com.kwan.shuyu.
netty_09_io
;
import
java.io.BufferedReader
;
import
java.io.DataOutputStream
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/
old
/Reactor.java
→
netty-01-nio/src/main/java/com/kwan/shuyu/
netty_09_io
/Reactor.java
浏览文件 @
0995889f
package
com.kwan.shuyu.
old
;
package
com.kwan.shuyu.
netty_09_io
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
netty-01-nio/src/main/java/com/kwan/shuyu/until/ByteBufferUtil.java
浏览文件 @
0995889f
package
com.kwan.shuyu.until
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.util.internal.StringUtil
;
import
java.nio.ByteBuffer
;
import
static
io
.
netty
.
util
.
internal
.
MathUtil
.
isOutOfBounds
;
import
static
io
.
netty
.
util
.
internal
.
StringUtil
.
NEWLINE
;
/**
* ByteBuffer工具类
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录