Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
netty-demo
提交
09577b2b
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看板
提交
09577b2b
编写于
4月 19, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:添加忽略文件
上级
abd5f2b5
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
51 addition
and
36 deletion
+51
-36
src/main/java/com/kwan/shuyu/heima/ByteBuffer_01_Write.java
src/main/java/com/kwan/shuyu/heima/ByteBuffer_01_Write.java
+1
-1
src/main/java/com/kwan/shuyu/heima/ByteBuffer_03_split.java
src/main/java/com/kwan/shuyu/heima/ByteBuffer_03_split.java
+1
-5
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_01_Test_FileChannel.java
...a/netty_01_bytebuffer/ByteBuffer_01_Test_FileChannel.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_02_Test_hasRemaining.java
.../netty_01_bytebuffer/ByteBuffer_02_Test_hasRemaining.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_03_Test_put.java
...uyu/heima/netty_01_bytebuffer/ByteBuffer_03_Test_put.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_04_Test_flip.java
...yu/heima/netty_01_bytebuffer/ByteBuffer_04_Test_flip.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_05_Test_compact.java
...heima/netty_01_bytebuffer/ByteBuffer_05_Test_compact.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_06_Test_allocate.java
...eima/netty_01_bytebuffer/ByteBuffer_06_Test_allocate.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_07_Test_read.java
...yu/heima/netty_01_bytebuffer/ByteBuffer_07_Test_read.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_08_Test_mark.java
...yu/heima/netty_01_bytebuffer/ByteBuffer_08_Test_mark.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_09_Test_get.java
...uyu/heima/netty_01_bytebuffer/ByteBuffer_09_Test_get.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_10_Test_String.java
.../heima/netty_01_bytebuffer/ByteBuffer_10_Test_String.java
+2
-2
src/main/java/com/kwan/shuyu/heima/netty_01_bytebuffer/ByteBuffer_11_Test_Read.java
...yu/heima/netty_01_bytebuffer/ByteBuffer_11_Test_Read.java
+4
-4
src/main/java/com/kwan/shuyu/heima/netty_02_file/File_01_Test_exists.java
...m/kwan/shuyu/heima/netty_02_file/File_01_Test_exists.java
+19
-0
src/main/java/com/kwan/shuyu/heima/netty_03_nio/nio_01_block/NioClient.java
...kwan/shuyu/heima/netty_03_nio/nio_01_block/NioClient.java
+1
-1
src/main/java/com/kwan/shuyu/heima/netty_03_nio/nio_01_block/NioServer.java
...kwan/shuyu/heima/netty_03_nio/nio_01_block/NioServer.java
+1
-1
src/main/java/com/kwan/shuyu/heima/netty_03_nio/nio_02_no_block/NioClient.java
...n/shuyu/heima/netty_03_nio/nio_02_no_block/NioClient.java
+1
-1
src/main/java/com/kwan/shuyu/heima/netty_03_nio/nio_02_no_block/NioServer.java
...n/shuyu/heima/netty_03_nio/nio_02_no_block/NioServer.java
+1
-1
src/main/java/com/kwan/shuyu/heima/netty_03_nio/nio_03_selector/NioClient.java
...n/shuyu/heima/netty_03_nio/nio_03_selector/NioClient.java
+1
-1
src/main/java/com/kwan/shuyu/heima/netty_03_nio/nio_03_selector/NioServer.java
...n/shuyu/heima/netty_03_nio/nio_03_selector/NioServer.java
+1
-1
target/classes/com/kwan/shuyu/heima/nio/nio_001_block/NioClient.class
...es/com/kwan/shuyu/heima/nio/nio_001_block/NioClient.class
+0
-0
target/classes/com/kwan/shuyu/heima/nio/nio_001_block/NioServer.class
...es/com/kwan/shuyu/heima/nio/nio_001_block/NioServer.class
+0
-0
target/classes/com/kwan/shuyu/heima/nio/nio_002_no_block/NioClient.class
...com/kwan/shuyu/heima/nio/nio_002_no_block/NioClient.class
+0
-0
target/classes/com/kwan/shuyu/heima/nio/nio_002_no_block/NioServer.class
...com/kwan/shuyu/heima/nio/nio_002_no_block/NioServer.class
+0
-0
target/classes/com/kwan/shuyu/heima/nio/nio_003_selector/NioClient.class
...com/kwan/shuyu/heima/nio/nio_003_selector/NioClient.class
+0
-0
target/classes/com/kwan/shuyu/heima/nio/nio_003_selector/NioServer.class
...com/kwan/shuyu/heima/nio/nio_003_selector/NioServer.class
+0
-0
未找到文件。
src/main/java/com/kwan/shuyu/heima/ByteBuffer_0
0
1_Write.java
→
src/main/java/com/kwan/shuyu/heima/ByteBuffer_01_Write.java
浏览文件 @
09577b2b
...
...
@@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets;
* @version : 2.2.0
* @date : 2023/4/18 17:15
*/
public
class
ByteBuffer_0
0
1_Write
{
public
class
ByteBuffer_01_Write
{
public
static
void
main
(
String
[]
args
)
{
final
ByteBuffer
b1
=
StandardCharsets
.
UTF_8
.
encode
(
"hello"
);
final
ByteBuffer
b2
=
StandardCharsets
.
UTF_8
.
encode
(
"world"
);
...
...
src/main/java/com/kwan/shuyu/heima/ByteBuffer_0
0
3_split.java
→
src/main/java/com/kwan/shuyu/heima/ByteBuffer_03_split.java
浏览文件 @
09577b2b
...
...
@@ -7,11 +7,7 @@ package com.kwan.shuyu.heima;
* @version : 2.2.0
* @date : 2023/4/18 17:15
*/
public
class
ByteBuffer_0
0
3_split
{
public
class
ByteBuffer_03_split
{
public
static
void
main
(
String
[]
args
)
{
}
}
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_001_Test
.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_01_Test_FileChannel
.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
java.io.FileInputStream
;
import
java.nio.ByteBuffer
;
...
...
@@ -11,7 +11,7 @@ import java.nio.channels.FileChannel;
* @version : 2.2.0
* @date : 2023/4/18 17:15
*/
public
class
ByteBuffer_0
01_Test
{
public
class
ByteBuffer_0
1_Test_FileChannel
{
public
static
void
main
(
String
[]
args
)
{
try
(
FileChannel
channel
=
new
FileInputStream
(
"data.txt"
).
getChannel
())
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_002_Test
.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_02_Test_hasRemaining
.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -14,7 +14,7 @@ import java.nio.channels.FileChannel;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
02_Test
{
public
class
ByteBuffer_0
2_Test_hasRemaining
{
public
static
void
main
(
String
[]
args
)
{
try
(
FileChannel
channel
=
new
FileInputStream
(
"data.txt"
).
getChannel
())
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
03_Test_put.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
03_Test_put.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
0
3_Test_put
{
public
class
ByteBuffer_03_Test_put
{
public
static
void
main
(
String
[]
args
)
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
buffer
.
put
((
byte
)
0x61
);
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
04_Test_flip.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
04_Test_flip.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
0
4_Test_flip
{
public
class
ByteBuffer_04_Test_flip
{
public
static
void
main
(
String
[]
args
)
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
buffer
.
put
((
byte
)
0x61
);
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
05_Test_compact.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
05_Test_compact.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -14,7 +14,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
0
5_Test_compact
{
public
class
ByteBuffer_05_Test_compact
{
public
static
void
main
(
String
[]
args
)
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
buffer
.
put
((
byte
)
0x61
);
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
06_Test_allocate.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
06_Test_allocate.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -12,7 +12,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
0
6_Test_allocate
{
public
class
ByteBuffer_06_Test_allocate
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
ByteBuffer
.
allocate
(
16
).
getClass
().
getSimpleName
());
System
.
out
.
println
(
ByteBuffer
.
allocateDirect
(
16
).
getClass
().
getSimpleName
());
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
07_Test_read.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
07_Test_read.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -13,7 +13,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
0
7_Test_read
{
public
class
ByteBuffer_07_Test_read
{
public
static
void
main
(
String
[]
args
)
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
buffer
.
put
(
new
byte
[]{
'a'
,
'b'
,
'c'
,
'd'
});
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
08_Test_mark.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
08_Test_mark.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -12,7 +12,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
0
8_Test_mark
{
public
class
ByteBuffer_08_Test_mark
{
public
static
void
main
(
String
[]
args
)
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
buffer
.
put
(
new
byte
[]{
'a'
,
'b'
,
'c'
,
'd'
});
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
09_Test_get.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
09_Test_get.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -12,7 +12,7 @@ import java.nio.ByteBuffer;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_0
0
9_Test_get
{
public
class
ByteBuffer_09_Test_get
{
public
static
void
main
(
String
[]
args
)
{
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
10
);
buffer
.
put
(
new
byte
[]{
'a'
,
'b'
,
'c'
,
'd'
});
...
...
src/main/java/com/kwan/shuyu/heima/
bytebuffer/ByteBuffer_0
10_Test_String.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_
10_Test_String.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.bytebuffer
;
package
com.kwan.shuyu.heima.
netty_01_
bytebuffer
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -15,7 +15,7 @@ import static com.kwan.shuyu.until.ByteBufferUtil.debugAll;
* @date : 2023/4/18 17:15
*/
@Slf4j
public
class
ByteBuffer_
0
10_Test_String
{
public
class
ByteBuffer_10_Test_String
{
public
static
void
main
(
String
[]
args
)
{
//方式一,不会自动切换到读模式
ByteBuffer
buffer1
=
ByteBuffer
.
allocate
(
16
);
...
...
src/main/java/com/kwan/shuyu/heima/
ByteBuffer_002
_Read.java
→
src/main/java/com/kwan/shuyu/heima/
netty_01_bytebuffer/ByteBuffer_11_Test
_Read.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima
;
package
com.kwan.shuyu.heima
.netty_01_bytebuffer
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
...
...
@@ -8,15 +8,15 @@ import java.nio.ByteBuffer;
import
java.nio.channels.FileChannel
;
/**
*
读取文件内容并打印ByteBuffer
*
分散读取
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/4/18 18:01
*/
public
class
ByteBuffer_
002
_Read
{
public
class
ByteBuffer_
11_Test
_Read
{
public
static
void
main
(
String
[]
args
)
{
try
(
RandomAccessFile
file
=
new
RandomAccessFile
(
"
/Users/qinyingjie/Documents/idea-workspace/ant/ant-netty/src/main/java/com/xiaofei/antnetty/
3parts.txt"
,
"rw"
))
{
try
(
RandomAccessFile
file
=
new
RandomAccessFile
(
"3parts.txt"
,
"rw"
))
{
FileChannel
channel
=
file
.
getChannel
();
ByteBuffer
a
=
ByteBuffer
.
allocate
(
3
);
ByteBuffer
b
=
ByteBuffer
.
allocate
(
3
);
...
...
src/main/java/com/kwan/shuyu/heima/netty_02_file/File_01_Test_exists.java
0 → 100644
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.netty_02_file
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
/**
* 检查文件是否存在
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/4/18 17:15
*/
public
class
File_01_Test_exists
{
public
static
void
main
(
String
[]
args
)
{
Path
path
=
Paths
.
get
(
".gitignore"
);
System
.
out
.
println
(
Files
.
exists
(
path
));
}
}
src/main/java/com/kwan/shuyu/heima/n
io/nio_0
01_block/NioClient.java
→
src/main/java/com/kwan/shuyu/heima/n
etty_03_nio/nio_
01_block/NioClient.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.n
io.nio_0
01_block
;
package
com.kwan.shuyu.heima.n
etty_03_nio.nio_
01_block
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
src/main/java/com/kwan/shuyu/heima/n
io/nio_0
01_block/NioServer.java
→
src/main/java/com/kwan/shuyu/heima/n
etty_03_nio/nio_
01_block/NioServer.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.n
io.nio_0
01_block
;
package
com.kwan.shuyu.heima.n
etty_03_nio.nio_
01_block
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
src/main/java/com/kwan/shuyu/heima/n
io/nio_0
02_no_block/NioClient.java
→
src/main/java/com/kwan/shuyu/heima/n
etty_03_nio/nio_
02_no_block/NioClient.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.n
io.nio_0
02_no_block
;
package
com.kwan.shuyu.heima.n
etty_03_nio.nio_
02_no_block
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
src/main/java/com/kwan/shuyu/heima/n
io/nio_0
02_no_block/NioServer.java
→
src/main/java/com/kwan/shuyu/heima/n
etty_03_nio/nio_
02_no_block/NioServer.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.n
io.nio_0
02_no_block
;
package
com.kwan.shuyu.heima.n
etty_03_nio.nio_
02_no_block
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
src/main/java/com/kwan/shuyu/heima/n
io/nio_0
03_selector/NioClient.java
→
src/main/java/com/kwan/shuyu/heima/n
etty_03_nio/nio_
03_selector/NioClient.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.n
io.nio_0
03_selector
;
package
com.kwan.shuyu.heima.n
etty_03_nio.nio_
03_selector
;
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
...
...
src/main/java/com/kwan/shuyu/heima/n
io/nio_0
03_selector/NioServer.java
→
src/main/java/com/kwan/shuyu/heima/n
etty_03_nio/nio_
03_selector/NioServer.java
浏览文件 @
09577b2b
package
com.kwan.shuyu.heima.n
io.nio_0
03_selector
;
package
com.kwan.shuyu.heima.n
etty_03_nio.nio_
03_selector
;
import
com.kwan.shuyu.until.ByteBufferUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
target/classes/com/kwan/shuyu/heima/nio/nio_001_block/NioClient.class
已删除
100644 → 0
浏览文件 @
abd5f2b5
文件已删除
target/classes/com/kwan/shuyu/heima/nio/nio_001_block/NioServer.class
已删除
100644 → 0
浏览文件 @
abd5f2b5
文件已删除
target/classes/com/kwan/shuyu/heima/nio/nio_002_no_block/NioClient.class
已删除
100644 → 0
浏览文件 @
abd5f2b5
文件已删除
target/classes/com/kwan/shuyu/heima/nio/nio_002_no_block/NioServer.class
已删除
100644 → 0
浏览文件 @
abd5f2b5
文件已删除
target/classes/com/kwan/shuyu/heima/nio/nio_003_selector/NioClient.class
已删除
100644 → 0
浏览文件 @
abd5f2b5
文件已删除
target/classes/com/kwan/shuyu/heima/nio/nio_003_selector/NioServer.class
已删除
100644 → 0
浏览文件 @
abd5f2b5
文件已删除
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录