diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..5c98b42
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml
\ No newline at end of file
diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..49f7b87
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
new file mode 100644
index 0000000..8095114
--- /dev/null
+++ b/.idea/dbnavigator.xml
@@ -0,0 +1,456 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..4e44b98
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..17f4c1b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter01/.idea/checkstyle-idea.xml b/chapter01/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter01/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter01/.idea/encodings.xml b/chapter01/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter01/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter01/.idea/misc.xml b/chapter01/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter01/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter01/.idea/modules.xml b/chapter01/.idea/modules.xml
new file mode 100644
index 0000000..54a2f95
--- /dev/null
+++ b/chapter01/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter01/.idea/workspace.xml b/chapter01/.idea/workspace.xml
new file mode 100644
index 0000000..abcd8da
--- /dev/null
+++ b/chapter01/.idea/workspace.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1578982001576
+
+
+ 1578982001576
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/.idea/checkstyle-idea.xml b/chapter02/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter02/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/.idea/encodings.xml b/chapter02/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter02/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/.idea/misc.xml b/chapter02/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter02/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/.idea/modules.xml b/chapter02/.idea/modules.xml
new file mode 100644
index 0000000..f683db6
--- /dev/null
+++ b/chapter02/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/.idea/workspace.xml b/chapter02/.idea/workspace.xml
new file mode 100644
index 0000000..f03aa1f
--- /dev/null
+++ b/chapter02/.idea/workspace.xml
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1578982197842
+
+
+ 1578982197842
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter02/chapter02.iml b/chapter02/chapter02.iml
index c90834f..1a7f0f7 100644
--- a/chapter02/chapter02.iml
+++ b/chapter02/chapter02.iml
@@ -7,5 +7,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter03/.idea/checkstyle-idea.xml b/chapter03/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter03/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter03/.idea/encodings.xml b/chapter03/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter03/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter03/.idea/misc.xml b/chapter03/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter03/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter03/.idea/modules.xml b/chapter03/.idea/modules.xml
new file mode 100644
index 0000000..65ac409
--- /dev/null
+++ b/chapter03/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter03/.idea/workspace.xml b/chapter03/.idea/workspace.xml
new file mode 100644
index 0000000..bfcb664
--- /dev/null
+++ b/chapter03/.idea/workspace.xml
@@ -0,0 +1,202 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1578993857829
+
+
+ 1578993857829
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/src/chapter03/example07/Example07.java
+ 16
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter04/.idea/checkstyle-idea.xml b/chapter04/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter04/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter04/.idea/encodings.xml b/chapter04/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter04/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter04/.idea/misc.xml b/chapter04/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter04/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter04/.idea/modules.xml b/chapter04/.idea/modules.xml
new file mode 100644
index 0000000..98e55a1
--- /dev/null
+++ b/chapter04/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter04/.idea/workspace.xml b/chapter04/.idea/workspace.xml
new file mode 100644
index 0000000..ff89d9b
--- /dev/null
+++ b/chapter04/.idea/workspace.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579051273754
+
+
+ 1579051273754
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter05/.idea/checkstyle-idea.xml b/chapter05/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter05/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter05/.idea/encodings.xml b/chapter05/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter05/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter05/.idea/misc.xml b/chapter05/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter05/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter05/.idea/modules.xml b/chapter05/.idea/modules.xml
new file mode 100644
index 0000000..a8d4836
--- /dev/null
+++ b/chapter05/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter05/.idea/workspace.xml b/chapter05/.idea/workspace.xml
new file mode 100644
index 0000000..26fa52d
--- /dev/null
+++ b/chapter05/.idea/workspace.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579072257379
+
+
+ 1579072257379
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter06/.idea/checkstyle-idea.xml b/chapter06/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter06/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter06/.idea/encodings.xml b/chapter06/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter06/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter06/.idea/misc.xml b/chapter06/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter06/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter06/.idea/modules.xml b/chapter06/.idea/modules.xml
new file mode 100644
index 0000000..16c04a3
--- /dev/null
+++ b/chapter06/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter06/.idea/workspace.xml b/chapter06/.idea/workspace.xml
new file mode 100644
index 0000000..3209d20
--- /dev/null
+++ b/chapter06/.idea/workspace.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579090023116
+
+
+ 1579090023116
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/.idea/checkstyle-idea.xml b/chapter07/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter07/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/.idea/encodings.xml b/chapter07/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter07/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/.idea/misc.xml b/chapter07/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter07/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/.idea/modules.xml b/chapter07/.idea/modules.xml
new file mode 100644
index 0000000..98f74a4
--- /dev/null
+++ b/chapter07/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/.idea/workspace.xml b/chapter07/.idea/workspace.xml
new file mode 100644
index 0000000..0d8d870
--- /dev/null
+++ b/chapter07/.idea/workspace.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579154110406
+
+
+ 1579154110406
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter07/client.txt b/chapter07/client.txt
deleted file mode 100644
index 5eebd50..0000000
--- a/chapter07/client.txt
+++ /dev/null
@@ -1 +0,0 @@
-I really like you
\ No newline at end of file
diff --git a/chapter07/src/chapter07/example01/Example01.java b/chapter07/src/chapter07/example01/Example01.java
index 315939d..98651af 100644
--- a/chapter07/src/chapter07/example01/Example01.java
+++ b/chapter07/src/chapter07/example01/Example01.java
@@ -8,8 +8,7 @@
public class Example01 {
public static void main(String[] args) throws Exception {
// 创建一个文件字节输入流
- // 相对项目根目录的路径
- FileInputStream in = new FileInputStream("client.txt");
+ FileInputStream in = new FileInputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\client.txt");
int b = 0; // 定义一个int类型的变量b,记住每次读取的一个字节
while (true) {
b = in.read(); // 变量b记住读取的一个字节
diff --git a/chapter07/src/chapter07/example02/Example02.java b/chapter07/src/chapter07/example02/Example02.java
index 61d9a4d..b1f1898 100644
--- a/chapter07/src/chapter07/example02/Example02.java
+++ b/chapter07/src/chapter07/example02/Example02.java
@@ -8,7 +8,7 @@
public class Example02 {
public static void main(String[] args) throws Exception {
// 创建一个文件字节输出流
- FileOutputStream out = new FileOutputStream("./target/example.txt");
+ FileOutputStream out = new FileOutputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\target\\example.txt");
String str = "我喜欢你的每一分,每一秒";
byte[] b = str.getBytes();
for (int i = 0; i < b.length; i++) {
diff --git a/chapter07/src/chapter07/example03/Example03.java b/chapter07/src/chapter07/example03/Example03.java
index e0eeb51..b67996a 100644
--- a/chapter07/src/chapter07/example03/Example03.java
+++ b/chapter07/src/chapter07/example03/Example03.java
@@ -8,7 +8,7 @@
*/
public class Example03 {
public static void main(String[] args) throws Exception {
- OutputStream out = new FileOutputStream("./target/example.txt", true);
+ OutputStream out = new FileOutputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\target\\example.txt", true);
String str = "\n最美的是你的名字";
byte[] b = str.getBytes();
for (int i = 0; i < b.length; i++) {
diff --git a/chapter07/src/chapter07/example04/Example04.java b/chapter07/src/chapter07/example04/Example04.java
index 9235edf..022e027 100644
--- a/chapter07/src/chapter07/example04/Example04.java
+++ b/chapter07/src/chapter07/example04/Example04.java
@@ -11,9 +11,9 @@
public class Example04 {
public static void main(String[] args) throws Exception {
// 创建一个字节输入流,用于读取当前目录下source文件夹中的mp3文件
- InputStream in = new FileInputStream("./source/歳月-雲流れ.mp3");
+ InputStream in = new FileInputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\source\\歳月-雲流れ.mp3");
// 创建一个文件字节输出流,用于将读取的数据写入target目录下的文件中
- OutputStream out = new FileOutputStream("./target/歳月-雲流れ.mp3");
+ OutputStream out = new FileOutputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\target\\歳月-雲流れ.mp3");
int len; // 定义一个int类型的变量len,记住每次读取的一个字节
long beginTime = System.currentTimeMillis(); // 获取拷贝文件前的系统时间
while ((len = in.read()) != -1) { // 读取一个字节并判断是否读到文件末尾
diff --git a/chapter07/src/chapter07/example05/Example05.java b/chapter07/src/chapter07/example05/Example05.java
index be0bb69..31f25c1 100644
--- a/chapter07/src/chapter07/example05/Example05.java
+++ b/chapter07/src/chapter07/example05/Example05.java
@@ -11,9 +11,9 @@
public class Example05 {
public static void main(String[] args) throws Exception {
// 创建一个字节输入流,用于读取当前目录下source文件夹中的mp3文件
- InputStream in = new FileInputStream("./source/歳月-雲流れ.mp3");
+ InputStream in = new FileInputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\source\\歳月-雲流れ.mp3");
// 创建一个文件字节输出流,用于将读取的数据写入当前目录的target文件中
- OutputStream out = new FileOutputStream("./target/歳月-雲流れ.mp3");
+ OutputStream out = new FileOutputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\target\\歳月-雲流れ.mp3");
// 以下是用缓冲区读写文件
byte[] buff = new byte[1024]; // 定义一个字节数组,作为缓冲区
// 定义一个int类型的变量len记住读取读入缓冲区的字节数
diff --git a/chapter07/src/chapter07/example06/Example06.java b/chapter07/src/chapter07/example06/Example06.java
index ded59d3..88080ce 100644
--- a/chapter07/src/chapter07/example06/Example06.java
+++ b/chapter07/src/chapter07/example06/Example06.java
@@ -8,15 +8,14 @@
/**
* BufferedInputStream和BufferedOutputStream 这两个流的用法
*/
-
public class Example06 {
public static void main(String[] args) throws Exception {
// 创建一个带缓冲区的输入流
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(
- "src.txt"));
+ "D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\src.txt"));
// 创建一个带缓冲区的输出流
BufferedOutputStream bos = new BufferedOutputStream(
- new FileOutputStream("des.txt"));
+ new FileOutputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\des.txt"));
int len;
while ((len = bis.read()) != -1) {
bos.write(len);
diff --git a/chapter07/src/chapter07/example07/Example07.java b/chapter07/src/chapter07/example07/Example07.java
index 04a86ae..a4f7be2 100644
--- a/chapter07/src/chapter07/example07/Example07.java
+++ b/chapter07/src/chapter07/example07/Example07.java
@@ -8,7 +8,7 @@
public class Example07 {
public static void main(String[] args) throws Exception {
// 创建一个FileReader对象用来读取文件中的字符
- FileReader reader = new FileReader("reader.txt");
+ FileReader reader = new FileReader("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\reader.txt");
int ch; // 定义一个变量用于记录读取的字符
while ((ch = reader.read()) != -1) { // 循环判断是否读取到文件的末尾
System.out.println((char) ch); // 不是字符流末尾就转为字符打印
diff --git a/chapter07/src/chapter07/example08/Example08.java b/chapter07/src/chapter07/example08/Example08.java
index b9045db..59a8a3c 100644
--- a/chapter07/src/chapter07/example08/Example08.java
+++ b/chapter07/src/chapter07/example08/Example08.java
@@ -8,7 +8,7 @@
public class Example08 {
public static void main(String[] args) throws Exception {
// 创建一个FileWriter对象用于向文件中写入数据
- FileWriter writer = new FileWriter("writer.txt");
+ FileWriter writer = new FileWriter("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\writer.txt");
String str = "请问,你是我的master吗?";
writer.write(str); // 将字符数据写入到文本文件中
writer.write("\r\n"); // 将输出语句换行
diff --git a/chapter07/src/chapter07/example09/Example09.java b/chapter07/src/chapter07/example09/Example09.java
index e8329b8..6736c5e 100644
--- a/chapter07/src/chapter07/example09/Example09.java
+++ b/chapter07/src/chapter07/example09/Example09.java
@@ -10,10 +10,10 @@
*/
public class Example09 {
public static void main(String[] args) throws Exception {
- FileReader reader = new FileReader("src.txt");
+ FileReader reader = new FileReader("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\src.txt");
// 创建一个BufferedReader缓冲对象
BufferedReader br = new BufferedReader(reader);
- FileWriter writer = new FileWriter("des.txt");
+ FileWriter writer = new FileWriter("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\des.txt");
// 创建一个BufferdWriter缓冲区对象
BufferedWriter bw = new BufferedWriter(writer);
String str;
diff --git a/chapter07/src/chapter07/example10/Example10.java b/chapter07/src/chapter07/example10/Example10.java
index 9a3fb44..5a8c2e2 100644
--- a/chapter07/src/chapter07/example10/Example10.java
+++ b/chapter07/src/chapter07/example10/Example10.java
@@ -7,10 +7,10 @@
*/
public class Example10 {
public static void main(String[] args) throws Exception {
- FileInputStream in = new FileInputStream("src.txt");// 创建字节输入流
+ FileInputStream in = new FileInputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\src.txt");// 创建字节输入流
InputStreamReader isr = new InputStreamReader(in); // 将字节流输入转换成字符输入流
BufferedReader br = new BufferedReader(isr); // 赋予字符流对象缓冲区
- FileOutputStream out = new FileOutputStream("des.txt");
+ FileOutputStream out = new FileOutputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\des.txt");
// 将字节输出流转换成字符输出流
OutputStreamWriter osw = new OutputStreamWriter(out);
BufferedWriter bw = new BufferedWriter(osw); // 赋予字符输出流对象缓冲区
diff --git a/chapter07/src/chapter07/example11/Example11.java b/chapter07/src/chapter07/example11/Example11.java
index 9e7224e..ff2451f 100644
--- a/chapter07/src/chapter07/example11/Example11.java
+++ b/chapter07/src/chapter07/example11/Example11.java
@@ -7,15 +7,15 @@
*/
public class Example11 {
public static void main(String[] args) {
- File file = new File("./target/example.txt"); // 创建File文件对象,表示一个文件
+ File file = new File("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07\\target\\example.txt"); // 创建File文件对象,表示一个文件
// 获取文件名称
- System.out.println("文件名称:" + file.getName());
+ System.out.println("文件名称:" + file.getName());
// 获取文件的相对路径
- System.out.println("文件的相对路径:" + file.getPath());
+ System.out.println("文件的相对路径:" + file.getPath());
// 获取文件的绝对路径
- System.out.println("文件的绝对路径:" + file.getAbsolutePath());
+ System.out.println("文件的绝对路径:" + file.getAbsolutePath());
// 获取文件的父路径
- System.out.println("文件的父路径:" + file.getParent());
+ System.out.println("文件的父路径:" + file.getParent());
// 判断文件是否可读
System.out.println(file.canRead() ? "文件可读" : "文件不可读");
// 判断文件是否可写
@@ -27,10 +27,10 @@ public static void main(String[] args) {
// 判断是否是一个绝对路径
System.out.println(file.isAbsolute() ? "是绝对路径" : "不是绝对路径");
// 得到文件最后修改时间
- System.out.println("最后修改时间为:" + file.lastModified());
+ System.out.println("最后修改时间为:" + file.lastModified());
// 得到文件的大小
- System.out.println("文件大小为:" + file.length() + " bytes");
+ System.out.println("文件大小为:" + file.length() + " bytes");
// 是否成功删除文件
- System.out.println("是否成功删除文件:" + file.delete());
+ System.out.println("是否成功删除文件" + file.delete());
}
}
\ No newline at end of file
diff --git a/chapter07/src/chapter07/example12/Example12.java b/chapter07/src/chapter07/example12/Example12.java
index 33f4b33..15db549 100644
--- a/chapter07/src/chapter07/example12/Example12.java
+++ b/chapter07/src/chapter07/example12/Example12.java
@@ -6,14 +6,12 @@
* list()方法的用法
*/
public class Example12 {
- public static void main(String[] args) {
- File file = new File("./"); // 创建File对象
+ public static void main(String[] args) throws Exception {
+ File file = new File("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07"); // 创建File对象
if (file.isDirectory()) { // 判断File对象对应的目录是否存在
String[] names = file.list(); // 获得目录下的所有文件的文件名
- if (names != null) {
- for (String name : names) {
- System.out.println(name); // 输出文件名
- }
+ for (String name : names) {
+ System.out.println(name); // 输出文件名
}
}
}
diff --git a/chapter07/src/chapter07/example13/Example13.java b/chapter07/src/chapter07/example13/Example13.java
index 72c273c..7fc7e99 100644
--- a/chapter07/src/chapter07/example13/Example13.java
+++ b/chapter07/src/chapter07/example13/Example13.java
@@ -7,21 +7,25 @@
* 遍历指定目录下所有扩展名为.txt的文件
*/
public class Example13 {
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
// 创建File对象
- File file = new File("./");
+ File file = new File("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07");
// 创建过滤器对象
FilenameFilter filter = new FilenameFilter() {
// 实现accept()方法
public boolean accept(File dir, String name) {
File currFile = new File(dir, name);
// 如果文件名以.txt结尾返回true,否则返回false
- return currFile.isFile() && name.endsWith(".txt");
+ if (currFile.isFile() && name.endsWith(".txt")) {
+ return true;
+ } else {
+ return false;
+ }
}
};
if (file.exists()) { // 判断File对象对应的目录是否存在
String[] lists = file.list(filter); // 获得过滤后的所有文件名数组
- for (String name : lists != null ? lists : new String[0]) {
+ for (String name : lists) {
System.out.println(name);
}
}
diff --git a/chapter07/src/chapter07/example14/Example14.java b/chapter07/src/chapter07/example14/Example14.java
index 1803e90..b052d9f 100644
--- a/chapter07/src/chapter07/example14/Example14.java
+++ b/chapter07/src/chapter07/example14/Example14.java
@@ -1,5 +1,7 @@
package chapter07.example14;
+import org.jetbrains.annotations.NotNull;
+
import java.io.File;
/**
@@ -7,19 +9,17 @@
*/
public class Example14 {
public static void main(String[] args) {
- File file = new File("./"); // 创建一个代表目录的File对象
+ File file = new File("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter07"); // 创建一个代表目录的File对象
fileDir(file); // 调用FileDir方法
}
- public static void fileDir(File dir) {
+ public static void fileDir(@NotNull File dir) {
File[] files = dir.listFiles(); // 获得表示目录下所有文件的数组
- if (files != null) {
- for (File file : files) { // 遍历所有的子目录和文件
- if (file.isDirectory()) {
- fileDir(file); // 如果是目录,递归调用fileDir()
- }
- System.out.println(file.getAbsolutePath()); // 输出文件的绝对路径
+ for (File file : files) { // 遍历所有的子目录和文件
+ if (file.isDirectory()) {
+ fileDir(file); // 如果是目录,递归调用fileDir()
}
+ System.out.println(file.getAbsolutePath()); // 输出文件的绝对路径
}
}
}
\ No newline at end of file
diff --git a/chapter07/src/chapter07/example15/Example15.java b/chapter07/src/chapter07/example15/Example15.java
index 8f02faa..844da39 100644
--- a/chapter07/src/chapter07/example15/Example15.java
+++ b/chapter07/src/chapter07/example15/Example15.java
@@ -7,11 +7,9 @@
*/
public class Example15 {
public static void main(String[] args) {
- File file = new File("D:/test"); // 这是一个代表目录的File对象
+ File file = new File("D:\\test"); // 这是一个代表目录的File对象
if (file.exists()) {
- System.out.println(file.delete() + "目标删除");
- } else {
- System.out.println("目标不在");
+ System.out.println(file.delete());
}
}
}
\ No newline at end of file
diff --git a/chapter07/src/chapter07/example16/Example16.java b/chapter07/src/chapter07/example16/Example16.java
index 7ad2c02..aa9f61d 100644
--- a/chapter07/src/chapter07/example16/Example16.java
+++ b/chapter07/src/chapter07/example16/Example16.java
@@ -1,27 +1,29 @@
package chapter07.example16;
+import org.jetbrains.annotations.NotNull;
+
import java.io.File;
+import static java.lang.Thread.sleep;
+
/**
* 删除包含子文件的目录
*/
public class Example16 {
- public static void main(String[] args) {
+ public static void main(String[] args) throws InterruptedException {
File file = new File("D:\\test"); // 创建一个代表目录的File对象
deleteDir(file); // 调用deleteDir删除方法
}
- public static void deleteDir(File dir) {
+ public static void deleteDir(@NotNull File dir) {
if (dir.exists()) { // 判断传入的File对象是否存在
File[] files = dir.listFiles(); // 得到File数组
- if (files != null) {
- for (File file : files) { // 遍历所有的子目录和文件
- if (file.isDirectory()) {
- deleteDir(file); // 如果是目录,递归调用deleteDir()
- } else {
- // 如果是文件,直接删除
- file.delete();
- }
+ for (File file : files) { // 遍历所有的子目录和文件
+ if (file.isDirectory()) {
+ deleteDir(file); // 如果是目录,递归调用deleteDir()
+ } else {
+ // 如果是文件,直接删除
+ file.delete();
}
}
// 删除完一个目录里的所有文件后,就删除这个目录
diff --git a/chapter07/src/chapter07/task01/Books.java b/chapter07/src/chapter07/task01/Books.java
index 78c6070..ea7d697 100644
--- a/chapter07/src/chapter07/task01/Books.java
+++ b/chapter07/src/chapter07/task01/Books.java
@@ -23,8 +23,9 @@ public Books(int id, String name, double price, int number, double money,
@Override
public String toString() {
- return "图书编号:" + id + " 图书名称:" + name + " 出版社:" + Publish
+ String message = "图书编号:" + id + " 图书名称:" + name + " 出版社:" + Publish
+ " 单价:" + price + " 库存数量:" + number;
+ return message;
}
public void setNumber(int number) {
diff --git a/chapter07/src/chapter07/task01/FileUtil.java b/chapter07/src/chapter07/task01/FileUtil.java
index a0aba63..946568d 100644
--- a/chapter07/src/chapter07/task01/FileUtil.java
+++ b/chapter07/src/chapter07/task01/FileUtil.java
@@ -25,11 +25,13 @@ public static void saveBooks(Books books) {
Date date = new Date();
DateFormat format = new SimpleDateFormat("yyyyMMdd");// 定义日期格式
String name = "销售记录" + format.format(date) + ".csv";// 拼接文件名
- InputStream in;
+ InputStream in = null;
try {
in = new FileInputStream(name);// 判断本地是否存在此文件
- in.close();// 关闭输入流
- createFile(name, true, books);// 可获取输入流,则存在文件,采取修改文件方式
+ if (in != null) {
+ in.close();// 关闭输入流
+ createFile(name, true, books);// 可获取输入流,则存在文件,采取修改文件方式
+ }
} catch (FileNotFoundException e) {
createFile(name, false, books);// 输入流获取失败,则不存在文件,采取新建新文件方式
} catch (IOException e) {
@@ -46,7 +48,7 @@ public static void saveBooks(Books books) {
*/
public static void createFile(String name, boolean label, Books books) {
BufferedOutputStream out = null;
- StringBuilder builder = new StringBuilder();// 拼接内容
+ StringBuffer sbf = new StringBuffer();// 拼接内容
try {
if (label) {// 当已存在当天的文件,则在文件内容后追加
// 创建输出流,用于追加文件
@@ -58,17 +60,17 @@ public static void createFile(String name, boolean label, Books books) {
"单价", "总价", "出版社"};// 创建表头
for (String fieldKye : fieldSort) {
// 新建时,将表头存入本地文件
- builder.append(fieldKye).append(SEPARATE_FIELD);
+ sbf.append(fieldKye).append(SEPARATE_FIELD);
}
}
- builder.append(SEPARATE_LINE);// 追加换行符号
- builder.append(books.id).append(SEPARATE_FIELD);
- builder.append(books.name).append(SEPARATE_FIELD);
- builder.append(books.number).append(SEPARATE_FIELD);
- builder.append(books.price).append(SEPARATE_FIELD);
- builder.append(books.money).append(SEPARATE_FIELD);
- builder.append(books.Publish).append(SEPARATE_FIELD);
- String str = builder.toString();
+ sbf.append(SEPARATE_LINE);// 追加换行符号
+ sbf.append(books.id).append(SEPARATE_FIELD);
+ sbf.append(books.name).append(SEPARATE_FIELD);
+ sbf.append(books.number).append(SEPARATE_FIELD);
+ sbf.append((double) books.price).append(SEPARATE_FIELD);
+ sbf.append((double) books.money).append(SEPARATE_FIELD);
+ sbf.append(books.Publish).append(SEPARATE_FIELD);
+ String str = sbf.toString();
byte[] b = str.getBytes();
for (int i = 0; i < b.length; i++) {
out.write(b[i]);// 将内容写入本地文件
diff --git a/chapter07/src/chapter07/task01/RecordBooksOrder.java b/chapter07/src/chapter07/task01/RecordBooksOrder.java
index df42c12..acf25fd 100644
--- a/chapter07/src/chapter07/task01/RecordBooksOrder.java
+++ b/chapter07/src/chapter07/task01/RecordBooksOrder.java
@@ -1,12 +1,12 @@
package chapter07.task01;
-import jdk.internal.jline.internal.Nullable;
+import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Scanner;
public class RecordBooksOrder {
- static ArrayList booksList = new ArrayList<>();// 创建书架
+ static ArrayList booksList = new ArrayList();// 创建书架
public static void main(String[] args) {
init();// 初始化书架
diff --git a/chapter07/src/chapter07/task02/Notepad.java b/chapter07/src/chapter07/task02/Notepad.java
index 521b380..f30ab25 100644
--- a/chapter07/src/chapter07/task02/Notepad.java
+++ b/chapter07/src/chapter07/task02/Notepad.java
@@ -48,16 +48,16 @@ private static void createFile() {
message = "";// 新建文件时,暂存文件内容清空
Scanner sc = new Scanner(System.in);
System.out.println("请输入内容,停止编写请输入\"stop\":");// 提示
- StringBuilder builder = new StringBuilder();// 用于后期输入内容的拼接
+ StringBuffer stb = new StringBuffer();// 用于后期输入内容的拼接
String inputMessage = "";
while (!inputMessage.equals("stop")) {// 当输入“stop”时,停止输入
- if (builder.length() > 0) {
- builder.append("\r\n");// 追加换行符
+ if (stb.length() > 0) {
+ stb.append("\r\n");// 追加换行符
}
- builder.append(inputMessage);// 拼接输入信息
+ stb.append(inputMessage);// 拼接输入信息
inputMessage = sc.nextLine();// 获取输入信息
}
- message = builder.toString();// 将输入内容暂存
+ message = stb.toString();// 将输入内容暂存
}
/**
diff --git a/chapter07/src/chapter07/task03/DocumentManager.java b/chapter07/src/chapter07/task03/DocumentManager.java
index 5040749..c6881fd 100644
--- a/chapter07/src/chapter07/task03/DocumentManager.java
+++ b/chapter07/src/chapter07/task03/DocumentManager.java
@@ -50,7 +50,7 @@ private static void searchByKeyWorld() {
}
}
- // *********2.指定后缀名检索文件******** //
+ // *********2.指定后缀名检索文件********//
private static void searchBySuffix() {
Scanner sc = new Scanner(System.in);
System.out.print("请输入要检索的目录位置:");
@@ -70,7 +70,7 @@ private static void searchBySuffix() {
}
}
- // *********3.复制文件/目录********** //
+ // *********3.复制文件/目录**********//
private static void copyDirectory() throws Exception {
Scanner sc = new Scanner(System.in);
System.out.print("请输入源目录:");
@@ -91,7 +91,7 @@ private static void copyDirectory() throws Exception {
FileUtils.copySrcPathToDestPath(srcFile, destFile);
}
- // *********4.退出********** //
+ // *********4.退出**********//
private static void exit() {
System.out.println("您已退出系统,谢谢使用!");
System.exit(0);
diff --git a/chapter07/src/chapter07/task03/FileUtils.java b/chapter07/src/chapter07/task03/FileUtils.java
index 5cac290..68c18bf 100644
--- a/chapter07/src/chapter07/task03/FileUtils.java
+++ b/chapter07/src/chapter07/task03/FileUtils.java
@@ -18,11 +18,15 @@ public static ArrayList listFiles(File file, final String key) {
public boolean accept(File dir, String name) {// 实现accept()方法
File currFile = new File(dir, name);
// 如果文件名包含关键字返回true,否则返回false
- return currFile.isFile() && name.contains(key);
+ if (currFile.isFile() && name.contains(key)) {
+ return true;
+ }
+ return false;
}
};
// 递归方式获取规定的路径
- return fileDir(file, filter);
+ ArrayList arraylist = fileDir(file, filter);
+ return arraylist;
}
/**
@@ -47,7 +51,8 @@ public boolean accept(File dir, String name) {// 实现accept()方法
}
};
// 递归方式获取规定的路径
- return fileDir(file, filter);
+ ArrayList arraylist = fileDir(file, filter);
+ return arraylist;
}
/**
@@ -57,14 +62,14 @@ public boolean accept(File dir, String name) {// 实现accept()方法
* @return 过滤器过滤后的文件路径
*/
public static ArrayList fileDir(File dir, FilenameFilter filter) {
- ArrayList arraylist = new ArrayList<>();
+ ArrayList arraylist = new ArrayList();
File[] lists = dir.listFiles(filter); // 获得过滤后的所有文件数组
- for (File list : lists != null ? lists : new File[0]) {
+ for (File list : lists) {
// 将文件的绝对路径放到集合中
arraylist.add(list.getAbsolutePath());
}
File[] files = dir.listFiles(); // 获得当前目录下所有文件的数组
- for (File file : files != null ? files : new File[0]) { // 遍历所有的子目录和文件
+ for (File file : files) { // 遍历所有的子目录和文件
if (file.isDirectory()) {
// 如果是目录,递归调用fileDir()
ArrayList every = fileDir(file, filter);
@@ -95,7 +100,7 @@ public static void copySrcPathToDestPath(File srcDir, File destDir)
FileInputStream input = new FileInputStream(files[i]);// 获取输入流
FileOutputStream output = new FileOutputStream(copiedFile);// 获取输出流
byte[] buffer = new byte[1024];// 创建缓冲区
- int n;
+ int n = 0;
// 循环读取字节
while ((n = input.read(buffer)) != -1) {
output.write(buffer, 0, n);
diff --git a/chapter08/.idea/checkstyle-idea.xml b/chapter08/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter08/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter08/.idea/encodings.xml b/chapter08/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter08/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter08/.idea/misc.xml b/chapter08/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter08/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter08/.idea/modules.xml b/chapter08/.idea/modules.xml
new file mode 100644
index 0000000..50ac772
--- /dev/null
+++ b/chapter08/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter08/.idea/workspace.xml b/chapter08/.idea/workspace.xml
new file mode 100644
index 0000000..0b67058
--- /dev/null
+++ b/chapter08/.idea/workspace.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579227422058
+
+
+ 1579227422058
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter09/chapter09.iml b/chapter09/.idea/chapter09.iml
similarity index 70%
rename from chapter09/chapter09.iml
rename to chapter09/.idea/chapter09.iml
index 1c0878f..e91de6b 100644
--- a/chapter09/chapter09.iml
+++ b/chapter09/.idea/chapter09.iml
@@ -2,15 +2,13 @@
-
-
-
+
-
+
diff --git a/chapter09/.idea/checkstyle-idea.xml b/chapter09/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter09/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter09/.idea/encodings.xml b/chapter09/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter09/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter09/.idea/misc.xml b/chapter09/.idea/misc.xml
new file mode 100644
index 0000000..4d3a464
--- /dev/null
+++ b/chapter09/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/chapter09/.idea/modules.xml b/chapter09/.idea/modules.xml
new file mode 100644
index 0000000..db1601a
--- /dev/null
+++ b/chapter09/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter09/.idea/workspace.xml b/chapter09/.idea/workspace.xml
new file mode 100644
index 0000000..13ffbff
--- /dev/null
+++ b/chapter09/.idea/workspace.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579242527212
+
+
+ 1579242527212
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter09/src/example/Example01.java b/chapter09/src/example/Example01.java
index 6522fc9..7b6d88b 100644
--- a/chapter09/src/example/Example01.java
+++ b/chapter09/src/example/Example01.java
@@ -11,12 +11,12 @@ public static void main(String[] args) {
// 1. 注册数据库的驱动
Class.forName("org.sqlite.JDBC");
// 2.通过DriverManager获取数据库连接
- String url = "jdbc:sqlite:src/test1.db";
+ String url = "jdbc:sqlite:D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter09\\src\\test1.db";
conn = DriverManager.getConnection(url);
// 3.通过Connection对象获取Statement对象
stmt = conn.createStatement();
// 4.使用Statement执行SQL语句。
- String sql = "SELECT * FROM users";
+ String sql = "select * from users";
rs = stmt.executeQuery(sql);
// 5. 操作ResultSet结果集
System.out.println("id | name | password | email | birthday");
diff --git a/chapter09/src/example/Example02.java b/chapter09/src/example/Example02.java
index 30fa655..7673e4d 100644
--- a/chapter09/src/example/Example02.java
+++ b/chapter09/src/example/Example02.java
@@ -11,12 +11,12 @@ public static void main(String[] args) throws SQLException {
// 1. 注册数据库的驱动
Class.forName("org.sqlite.JDBC");
// 2.通过DriverManager获取数据库连接
- String url = "jdbc:sqlite:src/test1.db";
+ String url = "jdbc:sqlite:D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter09\\src\\test1.db";
conn = DriverManager.getConnection(url);
// 3.通过Connection对象获取Statement对象
stmt = conn.createStatement();
// 4.使用Statement执行SQL语句。
- String sql = "SELECT * FROM users";
+ String sql = "select * from users";
rs = stmt.executeQuery(sql);
// 5. 操作ResultSet结果集
System.out.println("id | name | password | email | birthday");
diff --git a/chapter09/src/example/Example03.java b/chapter09/src/example/Example03.java
index dedb394..eaa354b 100644
--- a/chapter09/src/example/Example03.java
+++ b/chapter09/src/example/Example03.java
@@ -9,7 +9,7 @@ public static void main(String[] args) throws SQLException {
try {
// 加载数据库驱动
Class.forName("org.sqlite.JDBC");
- String url = "jdbc:sqlite:src/test1.db";
+ String url = "jdbc:sqlite:D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter09\\src\\test1.db";
// 创建应用程序与数据库连接的Connection对象
conn = DriverManager.getConnection(url);
// 执行的SQL语句
diff --git a/chapter09/src/example/Example04.java b/chapter09/src/example/Example04.java
index e8e02f6..80906b8 100644
--- a/chapter09/src/example/Example04.java
+++ b/chapter09/src/example/Example04.java
@@ -8,7 +8,7 @@ public static void main(String[] args) {
Statement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
- String url = "jdbc:sqlite:src/test1.db";
+ String url = "jdbc:sqlite:D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter09\\src\\test1.db";
//1.获取Connection对象
conn = DriverManager.getConnection(url);
String sql = "select * from users";
diff --git a/chapter09/src/fruitstore.db b/chapter09/src/fruitstore.db
index e3cf0bb..4e3eaae 100644
Binary files a/chapter09/src/fruitstore.db and b/chapter09/src/fruitstore.db differ
diff --git a/chapter09/src/fruitstore/tools/JDBCUtils.java b/chapter09/src/fruitstore/tools/JDBCUtils.java
index 83959d7..c0e0d5b 100644
--- a/chapter09/src/fruitstore/tools/JDBCUtils.java
+++ b/chapter09/src/fruitstore/tools/JDBCUtils.java
@@ -14,7 +14,7 @@ public class JDBCUtils {
public static Connection getConnection() throws SQLException,
ClassNotFoundException {
Class.forName("org.sqlite.JDBC");
- String url = "jdbc:sqlite:src/fruitstore.db";
+ String url = "jdbc:sqlite:D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter09\\src\\fruitstore.db";
Connection conn = DriverManager.getConnection(url);
return conn;
}
diff --git a/chapter09/src/test1.db b/chapter09/src/test1.db
index 0f35de8..5fca671 100644
Binary files a/chapter09/src/test1.db and b/chapter09/src/test1.db differ
diff --git a/chapter10/.idea/checkstyle-idea.xml b/chapter10/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter10/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter10/.idea/encodings.xml b/chapter10/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter10/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter10/.idea/misc.xml b/chapter10/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter10/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter10/.idea/modules.xml b/chapter10/.idea/modules.xml
new file mode 100644
index 0000000..eb64f60
--- /dev/null
+++ b/chapter10/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter10/.idea/workspace.xml b/chapter10/.idea/workspace.xml
new file mode 100644
index 0000000..de41f0a
--- /dev/null
+++ b/chapter10/.idea/workspace.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579252265926
+
+
+ 1579252265926
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/.idea/checkstyle-idea.xml b/chapter11/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..35a25da
--- /dev/null
+++ b/chapter11/.idea/checkstyle-idea.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/.idea/codeStyles/Project.xml b/chapter11/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..3cdc6ae
--- /dev/null
+++ b/chapter11/.idea/codeStyles/Project.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/.idea/dbnavigator.xml b/chapter11/.idea/dbnavigator.xml
new file mode 100644
index 0000000..8095114
--- /dev/null
+++ b/chapter11/.idea/dbnavigator.xml
@@ -0,0 +1,456 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/.idea/encodings.xml b/chapter11/.idea/encodings.xml
new file mode 100644
index 0000000..c2bae49
--- /dev/null
+++ b/chapter11/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/.idea/misc.xml b/chapter11/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/chapter11/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/.idea/modules.xml b/chapter11/.idea/modules.xml
new file mode 100644
index 0000000..01ad30d
--- /dev/null
+++ b/chapter11/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/.idea/workspace.xml b/chapter11/.idea/workspace.xml
new file mode 100644
index 0000000..ad02e9f
--- /dev/null
+++ b/chapter11/.idea/workspace.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1579266748261
+
+
+ 1579266748261
+
+
+
+
\ No newline at end of file
diff --git a/chapter11/src/chapter11/task02/FileClient.java b/chapter11/src/chapter11/task02/FileClient.java
index 6868fa2..9b9d779 100644
--- a/chapter11/src/chapter11/task02/FileClient.java
+++ b/chapter11/src/chapter11/task02/FileClient.java
@@ -11,7 +11,7 @@ public static void main(String[] args) throws Exception {
Socket socket = new Socket("127.0.0.1", 10001); // 创建客户端Socket
OutputStream out = socket.getOutputStream(); // 获取Socket的输出流对象
// 创建FileInputStream对象
- FileInputStream fis = new FileInputStream("client.txt");
+ FileInputStream fis = new FileInputStream("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter11\\client.txt");
byte[] buf = new byte[1024]; // 定义一个字节数组
int len; // 定义一个int类型的变量len
while ((len = fis.read(buf)) != -1) { // 循环读取数据
diff --git a/chapter11/src/chapter11/task02/FileServer.java b/chapter11/src/chapter11/task02/FileServer.java
index f6a6e43..9360cbd 100644
--- a/chapter11/src/chapter11/task02/FileServer.java
+++ b/chapter11/src/chapter11/task02/FileServer.java
@@ -30,7 +30,7 @@ public void run() {
int count = 1; // 上传图片个数
try {
InputStream in = socket.getInputStream();
- File parentFile = new File("server.txt"); // 创建上传图片目录的File对象
+ File parentFile = new File("D:\\IntelliJ IDE\\Java基础案例教程\\Java基础案例教程\\chapter11\\server.txt"); // 创建上传图片目录的File对象
if (!parentFile.exists()) { // 如果不存在,就创建这个目录
parentFile.mkdir();
}
diff --git a/chapter09/test1.db b/test1.db
similarity index 100%
rename from chapter09/test1.db
rename to test1.db