Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_java
提交
9c9de578
S
skill_tree_java
项目概览
CSDN 技术社区
/
skill_tree_java
通知
42
Star
8
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_java
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c9de578
编写于
11月 15, 2021
作者:
CSDN-Ada助手
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add net questions
上级
22391b5f
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
660 addition
and
38 deletion
+660
-38
data/2.Java中阶/5.NIO/1.NIO概述/NIOAbstract.md
data/2.Java中阶/5.NIO/1.NIO概述/NIOAbstract.md
+1
-1
data/2.Java中阶/5.NIO/3.Channel(通道)/Channel.json
data/2.Java中阶/5.NIO/3.Channel(通道)/Channel.json
+8
-0
data/2.Java中阶/5.NIO/3.Channel(通道)/Channel.md
data/2.Java中阶/5.NIO/3.Channel(通道)/Channel.md
+31
-0
data/2.Java中阶/5.NIO/3.Channel(通道)/ChannelType.json
data/2.Java中阶/5.NIO/3.Channel(通道)/ChannelType.json
+8
-0
data/2.Java中阶/5.NIO/3.Channel(通道)/ChannelType.md
data/2.Java中阶/5.NIO/3.Channel(通道)/ChannelType.md
+31
-0
data/2.Java中阶/5.NIO/3.Channel(通道)/config.json
data/2.Java中阶/5.NIO/3.Channel(通道)/config.json
+2
-1
data/2.Java中阶/5.NIO/4.Java新IO概述/config.json
data/2.Java中阶/5.NIO/4.Java新IO概述/config.json
+0
-8
data/2.Java中阶/5.NIO/4.字符集和Charset/Charset.json
data/2.Java中阶/5.NIO/4.字符集和Charset/Charset.json
+8
-0
data/2.Java中阶/5.NIO/4.字符集和Charset/Charset.md
data/2.Java中阶/5.NIO/4.字符集和Charset/Charset.md
+30
-0
data/2.Java中阶/5.NIO/4.字符集和Charset/config.json
data/2.Java中阶/5.NIO/4.字符集和Charset/config.json
+2
-1
data/2.Java中阶/5.NIO/5.使用Buffer/config.json
data/2.Java中阶/5.NIO/5.使用Buffer/config.json
+0
-8
data/2.Java中阶/5.NIO/5.文件锁/FileLock.json
data/2.Java中阶/5.NIO/5.文件锁/FileLock.json
+8
-0
data/2.Java中阶/5.NIO/5.文件锁/FileLock.md
data/2.Java中阶/5.NIO/5.文件锁/FileLock.md
+88
-0
data/2.Java中阶/5.NIO/5.文件锁/config.json
data/2.Java中阶/5.NIO/5.文件锁/config.json
+2
-1
data/2.Java中阶/5.NIO/6.Path接口/Path.json
data/2.Java中阶/5.NIO/6.Path接口/Path.json
+8
-0
data/2.Java中阶/5.NIO/6.Path接口/Path.md
data/2.Java中阶/5.NIO/6.Path接口/Path.md
+32
-0
data/2.Java中阶/5.NIO/6.Path接口/config.json
data/2.Java中阶/5.NIO/6.Path接口/config.json
+3
-2
data/2.Java中阶/5.NIO/6.使用Channel/config.json
data/2.Java中阶/5.NIO/6.使用Channel/config.json
+0
-8
data/2.Java中阶/5.NIO/7.Files工具类/Files.json
data/2.Java中阶/5.NIO/7.Files工具类/Files.json
+8
-0
data/2.Java中阶/5.NIO/7.Files工具类/Files.md
data/2.Java中阶/5.NIO/7.Files工具类/Files.md
+48
-0
data/2.Java中阶/5.NIO/7.Files工具类/config.json
data/2.Java中阶/5.NIO/7.Files工具类/config.json
+2
-1
data/2.Java中阶/6.网络编程/1.网络编程基础/Internet.json
data/2.Java中阶/6.网络编程/1.网络编程基础/Internet.json
+8
-0
data/2.Java中阶/6.网络编程/1.网络编程基础/Internet.md
data/2.Java中阶/6.网络编程/1.网络编程基础/Internet.md
+31
-0
data/2.Java中阶/6.网络编程/1.网络编程基础/config.json
data/2.Java中阶/6.网络编程/1.网络编程基础/config.json
+3
-2
data/2.Java中阶/6.网络编程/2.UDP通信/UDP.json
data/2.Java中阶/6.网络编程/2.UDP通信/UDP.json
+8
-0
data/2.Java中阶/6.网络编程/2.UDP通信/UDP.md
data/2.Java中阶/6.网络编程/2.UDP通信/UDP.md
+67
-0
data/2.Java中阶/6.网络编程/2.UDP通信/config.json
data/2.Java中阶/6.网络编程/2.UDP通信/config.json
+2
-1
data/2.Java中阶/6.网络编程/3.TCP通信/TCP.json
data/2.Java中阶/6.网络编程/3.TCP通信/TCP.json
+8
-0
data/2.Java中阶/6.网络编程/3.TCP通信/TCP.md
data/2.Java中阶/6.网络编程/3.TCP通信/TCP.md
+81
-0
data/2.Java中阶/6.网络编程/3.TCP通信/config.json
data/2.Java中阶/6.网络编程/3.TCP通信/config.json
+2
-1
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/Support.json
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/Support.json
+8
-0
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/Support.md
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/Support.md
+31
-0
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/config.json
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/config.json
+2
-1
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/HTTPClient.json
.../2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/HTTPClient.json
+8
-0
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/HTTPClient.md
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/HTTPClient.md
+39
-0
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/WebSocket.json
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/WebSocket.json
+8
-0
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/WebSocket.md
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/WebSocket.md
+31
-0
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/config.json
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/config.json
+3
-2
未找到文件。
data/2.Java中阶/5.NIO/1.NIO概述/NIOAbstract.md
浏览文件 @
9c9de578
...
...
@@ -15,7 +15,7 @@ NIO与传统IO变化不大
### A
```
NIO全称是no-blocking io
NIO全称是no-blocking io
(或者New IO)
```
### B
...
...
data/2.Java中阶/5.NIO/3.Channel(通道)/Channel.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"Channel.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/5.NIO/3.Channel(通道)/Channel.md
0 → 100644
浏览文件 @
9c9de578
# Channel
以下关于
`Channel`
的说法错误的是:
## 答案
```
DatagramChannel用于TCP数据读写
```
## 选项
### A
```
通道可以异步读写
```
### B
```
通道总是基于Buffer来读写数据
```
### C
```
通道可读可写
```
data/2.Java中阶/5.NIO/3.Channel(通道)/ChannelType.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"ChannelType.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/5.NIO/3.Channel(通道)/ChannelType.md
0 → 100644
浏览文件 @
9c9de578
# Channel Type
以下属于
`Channel`
类型的是:
## 答案
```
以上选项都是
```
## 选项
### A
```
SctpChannel,SctpMultiChannel,SctpServerChannel
```
### B
```
DatagramChannel,FileChannel
```
### C
```
ServerSocketChannel,ServerChannel
```
data/2.Java中阶/5.NIO/3.Channel(通道)/config.json
浏览文件 @
9c9de578
...
...
@@ -2,6 +2,6 @@
"node_id"
:
"java-1cbb9d1ea7c74caeaf8d88c2aad75965"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"Channel.json"
,
"ChannelType.json"
],
"title"
:
"Channel(通道)"
}
\ No newline at end of file
data/2.Java中阶/5.NIO/4.Java新IO概述/config.json
已删除
100644 → 0
浏览文件 @
22391b5f
{
"node_id"
:
"java-f824cb48cef64bbcad371bb304b26d10"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"title"
:
"Java新IO概述"
}
\ No newline at end of file
data/2.Java中阶/5.NIO/4.字符集和Charset/Charset.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"Charset.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/5.NIO/4.字符集和Charset/Charset.md
0 → 100644
浏览文件 @
9c9de578
# NIO Charset
以下关于
`NIO Charset`
说法正确的是:
## 答案
```
向ByteBuffer存放数据需要考虑字符集的编码方式
```
## 选项
### A
```
向ByteBuffer存放数据不需要考虑字符集的编码方式
```
### B
```
向CharBuffer中读取时需要考虑字符集的解码
```
### C
```
Charset类在java.io.charset包中
```
data/2.Java中阶/5.NIO/
7
.字符集和Charset/config.json
→
data/2.Java中阶/5.NIO/
4
.字符集和Charset/config.json
浏览文件 @
9c9de578
...
...
@@ -2,6 +2,6 @@
"node_id"
:
"java-984b508fc9a54650aa9509eeb198f925"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"Charset.json"
],
"title"
:
"字符集和Charset"
}
\ No newline at end of file
data/2.Java中阶/5.NIO/5.使用Buffer/config.json
已删除
100644 → 0
浏览文件 @
22391b5f
{
"node_id"
:
"java-4bae5939bee44a31ba92906e490293b0"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"title"
:
"使用Buffer"
}
\ No newline at end of file
data/2.Java中阶/5.NIO/5.文件锁/FileLock.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"FileLock.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/5.NIO/5.文件锁/FileLock.md
0 → 100644
浏览文件 @
9c9de578
# File Lock
使用多线程读写同一个文件,选出你认为最合理的一种读取方法:
## 答案
```
java
public
void
readFile
(
String
path
)
{
RandomAccessFile
file
=
null
;
FileLock
lock
=
null
;
try
{
file
=
new
RandomAccessFile
(
path
,
"rw"
);
FileChannel
fileChannel
=
file
.
getChannel
();
lock
=
fileChannel
.
lock
();
// read and write
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
);
}
finally
{
if
(
lock
!=
null
)
{
try
{
lock
.
release
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
file
!=
null
)
{
try
{
file
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
```
## 选项
### A
```
java
public
void
readFile
(
String
path
)
throws
IOException
{
RandomAccessFile
file
=
new
RandomAccessFile
(
path
,
"rw"
);
FileChannel
fileChannel
=
file
.
getChannel
();
// read and write
file
.
close
();
}
```
### B
```
java
public
void
readFile
(
String
path
)
throws
IOException
{
RandomAccessFile
file
=
new
RandomAccessFile
(
path
,
"rw"
);
FileChannel
fileChannel
=
file
.
getChannel
();
FileLock
lock
=
fileChannel
.
lock
();
// read and write
lock
.
release
();
file
.
close
();
}
```
### C
```
java
public
void
readFile
(
String
path
)
{
RandomAccessFile
file
=
null
;
FileLock
lock
=
null
;
try
{
file
=
new
RandomAccessFile
(
path
,
"rw"
);
FileChannel
fileChannel
=
file
.
getChannel
();
lock
=
fileChannel
.
lock
();
// read and write
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
);
}
finally
{
try
{
lock
.
release
();
file
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
```
data/2.Java中阶/5.NIO/
8
.文件锁/config.json
→
data/2.Java中阶/5.NIO/
5
.文件锁/config.json
浏览文件 @
9c9de578
...
...
@@ -2,6 +2,6 @@
"node_id"
:
"java-338c2cfa55b346a0a0cd4dfc61c40ae6"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"FileLock.json"
],
"title"
:
"文件锁"
}
\ No newline at end of file
data/2.Java中阶/5.NIO/6.Path接口/Path.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"Path.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/5.NIO/6.Path接口/Path.md
0 → 100644
浏览文件 @
9c9de578
# NIO Path
以下关于
`Path`
说法错误的是:
## 答案
```
Path是在Java 8中新增的
```
## 选项
### A
```
Path表示的路径与平台无关
```
### B
```
Path可以通过Paths.get()方法创建
```
### C
```
File可以替换Path
```
\ No newline at end of file
data/2.Java中阶/5.NIO/
9
.Path接口/config.json
→
data/2.Java中阶/5.NIO/
6
.Path接口/config.json
浏览文件 @
9c9de578
{
"node_id"
:
"java-386113b4f6274eb591e1f01b39f0c8ce"
,
"keywords"
:
[],
"keywords"
:
[
"Paths"
,
"Path"
],
"children"
:
[],
"export"
:
[],
"export"
:
[
"Path.json"
],
"title"
:
"Path接口"
}
\ No newline at end of file
data/2.Java中阶/5.NIO/6.使用Channel/config.json
已删除
100644 → 0
浏览文件 @
22391b5f
{
"node_id"
:
"java-9e2f3a44543c457e84d3d8a2e8321b65"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"title"
:
"使用Channel"
}
\ No newline at end of file
data/2.Java中阶/5.NIO/7.Files工具类/Files.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"Files.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/5.NIO/7.Files工具类/Files.md
0 → 100644
浏览文件 @
9c9de578
# Files
下列对于
`Files`
的相关操作方法,错误的是:
## 答案
```
java
// 复制文件,如果目的文件存在则会覆盖
public
void
copyFile
(
String
sourcePath
,
String
destPath
)
throws
IOException
{
Path
sp
=
Paths
.
get
(
sourcePath
);
Path
dp
=
Paths
.
get
(
destPath
);
Files
.
copy
(
sp
,
dp
);
}
```
## 选项
### A
```
java
// 判断文件是否存在
public
Boolean
isExists
(
String
filePath
)
{
Path
path
=
Paths
.
get
(
filePath
);
return
Files
.
exists
(
path
,
new
LinkOption
[]{
LinkOption
.
NOFOLLOW_LINKS
});
}
```
### B
```
java
// 删除文件
public
void
deleteFile
(
String
filePath
)
throws
IOException
{
Path
path
=
Paths
.
get
(
filePath
);
Files
.
delete
(
path
);
}
```
### C
```
java
// 创建文件
public
void
createFile
(
String
filePath
)
throws
IOException
{
Path
path
=
Paths
.
get
(
filePath
);
Files
.
createFile
(
path
);
}
```
data/2.Java中阶/5.NIO/
10
.Files工具类/config.json
→
data/2.Java中阶/5.NIO/
7
.Files工具类/config.json
浏览文件 @
9c9de578
...
...
@@ -2,6 +2,6 @@
"node_id"
:
"java-868e1323bfdf4c239a6552a45a30d48d"
,
"keywords"
:
[],
"children"
:
[],
"export"
:
[],
"export"
:
[
"Files.json"
],
"title"
:
"Files工具类"
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/1.网络编程基础/Internet.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"Internet.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/1.网络编程基础/Internet.md
0 → 100644
浏览文件 @
9c9de578
# 网络编程基础
下列对于
`网络编程`
的相关说法正确的是:
## 答案
```
以上说法均正确
```
## 选项
### A
```
TCP/IP协议是Internet最基础最广泛的协议
```
### B
```
IP地址是网络中计算机的唯一标识
```
### C
```
UDP是无连接的,TCP是有连接的
```
data/2.Java中阶/6.网络编程/1.网络编程基础/config.json
浏览文件 @
9c9de578
{
"node_id"
:
"java-59e7173695814c90858bc221e8688329"
,
"keywords"
:
[],
"keywords"
:
[
"网络"
,
"通信"
,
"协议"
],
"children"
:
[
{
"网络通信协议"
:
{
...
...
@@ -34,6 +34,6 @@
}
}
],
"export"
:
[],
"export"
:
[
"Internet.json"
],
"title"
:
"网络编程基础"
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/2.UDP通信/UDP.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"UDP.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/2.UDP通信/UDP.md
0 → 100644
浏览文件 @
9c9de578
# UDP
观察以下关于
`UDP`
的程序,接收端的输出为:
```
java
// 省略import
public
class
UDPSender
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
[]
messages
=
{
"你好!"
,
"我叫小白"
,
"很高兴认识你"
};
DatagramSocket
ds
=
new
DatagramSocket
();
for
(
String
message:
messages
)
{
byte
[]
data
=
message
.
getBytes
(
StandardCharsets
.
UTF_8
);
DatagramPacket
dp
=
new
DatagramPacket
(
data
,
data
.
length
,
InetAddress
.
getLocalHost
(),
8080
);
ds
.
send
(
dp
);
Thread
.
sleep
(
1000
);
}
ds
.
close
();
}
}
```
```
java
// 省略import
public
class
UDPReceive
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
DatagramSocket
ds
=
new
DatagramSocket
(
8080
);
byte
[]
data
=
new
byte
[
1024
];
while
(!
ds
.
isClosed
())
{
DatagramPacket
dp
=
new
DatagramPacket
(
data
,
data
.
length
);
ds
.
receive
(
dp
);
int
len
=
dp
.
getLength
();
System
.
out
.
println
(
new
String
(
data
,
0
,
len
));
}
ds
.
close
();
}
}
```
## 答案
```
你好!
我叫小白
很高兴认识你
```
## 选项
### A
```
¦ᄑᅠ¥ᆬᄑᄐチ
₩ネム¥マᆱ¥ᄚマルᄑ
¥ᄒネ←ᆱリ¥ナᄡ│ᆴᄂ│ᆵニ¦ᄑᅠ
```
### B
```
很高兴认识你
```
### C
```
啥都不输出
```
data/2.Java中阶/6.网络编程/2.UDP通信/config.json
浏览文件 @
9c9de578
...
...
@@ -41,6 +41,6 @@
}
}
],
"export"
:
[],
"export"
:
[
"UDP.json"
],
"title"
:
"UDP通信"
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/3.TCP通信/TCP.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"TCP.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/3.TCP通信/TCP.md
0 → 100644
浏览文件 @
9c9de578
# UDP
观察以下关于
`TCP`
的程序,服务端和客户端的输出为:
```
java
// 省略import
public
class
TCPClient
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
[]
messages
=
{
"你好!"
,
"我叫小白"
,
"很高兴认识你"
};
Socket
socket
=
new
Socket
(
InetAddress
.
getLocalHost
(),
8080
);
OutputStream
out
=
socket
.
getOutputStream
();
InputStream
in
=
socket
.
getInputStream
();
for
(
String
message:
messages
)
{
out
.
write
(
message
.
getBytes
());
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
in
.
read
(
buf
);
System
.
out
.
println
(
new
String
(
buf
,
0
,
len
));
}
socket
.
close
();
}
}
```
```
java
// 省略import
public
class
TCPServer
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
response
=
"收到"
;
ServerSocket
serverSocket
=
new
ServerSocket
(
8080
);
Socket
socket
=
serverSocket
.
accept
();
while
(
true
)
{
InputStream
in
=
socket
.
getInputStream
();
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
in
.
read
(
buf
);
if
(
len
==
-
1
)
{
continue
;
}
System
.
out
.
println
(
new
String
(
buf
,
0
,
len
));
OutputStream
out
=
socket
.
getOutputStream
();
out
.
write
(
response
.
getBytes
());
Thread
.
sleep
(
1000
);
}
}
}
```
## 答案
```
服务端的输出为:
你好!
我叫小白
很高兴认识你
```
## 选项
### A
```
客户端的输出为:
```
### B
```
服务端的输出为:
¦ᄑᅠ¥ᆬᄑᄐチ
₩ネム¥マᆱ¥ᄚマルᄑ
¥ᄒネ←ᆱリ¥ナᄡ│ᆴᄂ│ᆵニ¦ᄑᅠ
```
### C
```
服务端的输出为:
很高兴认识你
我叫小白
你好!
```
data/2.Java中阶/6.网络编程/3.TCP通信/config.json
浏览文件 @
9c9de578
...
...
@@ -48,6 +48,6 @@
}
}
],
"export"
:
[],
"export"
:
[
"TCP.json"
],
"title"
:
"TCP通信"
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/Support.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"Support.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/Support.md
0 → 100644
浏览文件 @
9c9de578
# Java基本网络支持
下列对于Java网络支持的相关说法错误的是:
## 答案
```
URI是统一资源标识符,可以用来定位资源
```
## 选项
### A
```
InetAddress类有两个子类:Inet4Address和Inet6Address
```
### B
```
URLDecoder和URLEncoder用于完成普通字符串和MIME字符串之间的相互转换
```
### C
```
URL是统一资源定位器
```
data/2.Java中阶/6.网络编程/5.Java的基本网络支持/config.json
浏览文件 @
9c9de578
...
...
@@ -19,6 +19,6 @@
}
}
],
"export"
:
[],
"export"
:
[
"Support.json"
],
"title"
:
"Java的基本网络支持"
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/HTTPClient.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"HTTPClient.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/HTTPClient.md
0 → 100644
浏览文件 @
9c9de578
# HTTPClient
下列语句皆为使用HTTPClient获取网页的流程之一,其中不正确的是:
## 答案
```
java
HttpResponse
.
BodyHandler
<
String
>
bodyHandler
=
HttpResponse
.
BodyHandlers
;
```
## 选项
### A
```
java
String
url
=
"https://www.baidu.com"
;
HttpClient
client
=
HttpClient
.
newBuilder
().
build
();
```
### B
```
java
HttpRequest
request
=
HttpRequest
.
newBuilder
()
.
uri
(
URI
.
create
(
url
))
.
header
(
"Content-Type"
,
"text/html"
)
.
GET
()
.
build
();
```
### C
```
java
HttpResponse
<
String
>
response
=
client
.
send
(
request
,
bodyHandler
);
if
(
response
.
statusCode
()
==
200
)
{
System
.
out
.
println
(
response
.
body
());
}
```
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/WebSocket.json
0 → 100644
浏览文件 @
9c9de578
{
"type"
:
"code_options"
,
"author"
:
"clong"
,
"source"
:
"WebSocket.md"
,
"exercise_id"
:
""
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/WebSocket.md
0 → 100644
浏览文件 @
9c9de578
# WebSocket
`WebSocket`
可以实现服务端对客户端的推送,避免客户端轮询,造成带宽资源浪费。以下关于
`WebSocket`
的说法错误的是:
## 答案
```
WebSockt与HTTP都是基于TCP的,因此url也是以HTTP开头
```
## 选项
### A
```
WebSocket基于TCP协议
```
### B
```
WebSocket是双向的,即全双工协议
```
### C
```
WebSocket是一种有状态的协议
```
data/2.Java中阶/6.网络编程/9.Java 11标准化的HTTP Client/config.json
浏览文件 @
9c9de578
{
"node_id"
:
"java-dd60957a0a7f4155a68aea7c6807d504"
,
"keywords"
:
[],
"keywords"
:
[
"websocket"
,
"get"
,
"post"
,
"delete"
,
"put"
,
"请求"
],
"children"
:
[
{
"发送同步GET请求"
:
{
...
...
@@ -41,6 +41,6 @@
}
}
],
"export"
:
[],
"export"
:
[
"HTTPClient.json"
,
"WebSocket.json"
],
"title"
:
"Java 11标准化的HTTP Client"
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录