Skip to content

Commit b8efd13

Browse files
committed
🎨将Eclipse项目的java文件的编码格式转化为gbk
1 parent 09dc957 commit b8efd13

File tree

360 files changed

+3035
-3035
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

360 files changed

+3035
-3035
lines changed

src/main/example10_12/ch10/例子1/Example10_1.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
package ch10.例子1;
1+
package ch10.例子1;
22

33
import java.io.File;
44
import java.io.IOException;
55
public class Example10_1 {
66
public static void main(String args[]) {
77
File f = new File("C:\\ch10","Example10_1.java");
8-
System.out.println(f.getName()+"是可读的吗:"+f.canRead());
9-
System.out.println(f.getName()+"的长度:"+f.length());
10-
System.out.println(f.getName()+"的绝对路径:"+f.getAbsolutePath());
8+
System.out.println(f.getName()+"是可读的吗:"+f.canRead());
9+
System.out.println(f.getName()+"的长度:"+f.length());
10+
System.out.println(f.getName()+"的绝对路径:"+f.getAbsolutePath());
1111
File file = new File("new.txt");
12-
System.out.println("在当前目录下创建新文件"+file.getName());
12+
System.out.println("在当前目录下创建新文件"+file.getName());
1313
if(!file.exists()) {
1414
try {
1515
file.createNewFile();
16-
System.out.println("创建成功");
16+
System.out.println("创建成功");
1717
}
1818
catch(IOException exp){}
1919
}

src/main/example10_12/ch10/例子10/Example10_10.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子10;
1+
package ch10.Àý×Ó10;
22

33
import java.io.ByteArrayInputStream;
44
import java.io.ByteArrayOutputStream;
@@ -10,14 +10,14 @@ public class Example10_10 {
1010
public static void main(String args[]) {
1111
try {
1212
ByteArrayOutputStream outByte = new ByteArrayOutputStream();
13-
byte[] byteContent = "国庆60周年".getBytes();
13+
byte[] byteContent = "¹úÇì60ÖÜÄê".getBytes();
1414
outByte.write(byteContent);
1515
ByteArrayInputStream inByte = new ByteArrayInputStream(outByte.toByteArray());
1616
byte backByte[] = new byte[outByte.toByteArray().length];
1717
inByte.read(backByte);
1818
System.out.println(new String(backByte));
1919
CharArrayWriter outChar = new CharArrayWriter();
20-
char[] charContent = "中秋快乐".toCharArray();
20+
char[] charContent = "ÖÐÇï¿ìÀÖ".toCharArray();
2121
outChar.write(charContent);
2222
CharArrayReader inChar = new CharArrayReader(outChar.toCharArray());
2323
char backChar[] = new char[outChar.toCharArray().length];

src/main/example10_12/ch10/例子11/Example10_11.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子11;
1+
package ch10.例子11;
22

33
import java.io.DataInputStream;
44
import java.io.DataOutputStream;
@@ -23,13 +23,13 @@ public static void main(String args[]) {
2323
try{
2424
FileInputStream fis=new FileInputStream(file);
2525
DataInputStream inData=new DataInputStream(fis);
26-
System.out.println(inData.readInt()); //读取int数据
27-
System.out.println(inData.readLong()); //读取long数据
28-
System.out.println(+inData.readFloat()); //读取float数据
29-
System.out.println(inData.readDouble()); //读取double数据
30-
System.out.println(inData.readBoolean());//读取boolean数据
26+
System.out.println(inData.readInt()); //读取int数据
27+
System.out.println(inData.readLong()); //读取long数据
28+
System.out.println(+inData.readFloat()); //读取float数据
29+
System.out.println(inData.readDouble()); //读取double数据
30+
System.out.println(inData.readBoolean());//读取boolean数据
3131
char c;
32-
while((c=inData.readChar())!='\0') { //'\0'表示空字符。
32+
while((c=inData.readChar())!='\0') { //'\0'表示空字符。
3333
System.out.print(c);
3434
}
3535
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
package ch10.例子12;
1+
package ch10.例子12;
22

33
public class EncryptAndDecrypt {
4-
String encrypt(String sourceString, String password) { // 加密算法
4+
String encrypt(String sourceString, String password) { // 加密算法
55
char[] p = password.toCharArray();
66
int n = p.length;
77
char[] c = sourceString.toCharArray();
88
int m = c.length;
99
for (int k = 0; k < m; k++) {
10-
int mima = c[k] + p[k % n]; // 加密
10+
int mima = c[k] + p[k % n]; // 加密
1111
c[k] = (char) mima;
1212
}
13-
return new String(c); // 返回密文
13+
return new String(c); // 返回密文
1414
}
1515

16-
String decrypt(String sourceString, String password) { // 解密算法
16+
String decrypt(String sourceString, String password) { // 解密算法
1717
char[] p = password.toCharArray();
1818
int n = p.length;
1919
char[] c = sourceString.toCharArray();
2020
int m = c.length;
2121
for (int k = 0; k < m; k++) {
22-
int mima = c[k] - p[k % n]; // 解密
22+
int mima = c[k] - p[k % n]; // 解密
2323
c[k] = (char) mima;
2424
}
25-
return new String(c); // 返回明文
25+
return new String(c); // 返回明文
2626
}
2727
}

src/main/example10_12/ch10/例子12/Example10_12.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子12;
1+
package ch10.例子12;
22

33
import java.io.DataInputStream;
44
import java.io.DataOutputStream;
@@ -9,7 +9,7 @@
99

1010
public class Example10_12 {
1111
public static void main(String args[]) {
12-
String command = "度江总攻时间是4月22日晚10点";
12+
String command = "度江总攻时间是4月22日晚10点";
1313
EncryptAndDecrypt person = new EncryptAndDecrypt();
1414
String password = "Tiger";
1515
String secret = person.encrypt(command, password);
@@ -18,15 +18,15 @@ public static void main(String args[]) {
1818
FileOutputStream fos = new FileOutputStream(file);
1919
DataOutputStream outData = new DataOutputStream(fos);
2020
outData.writeUTF(secret);
21-
System.out.println("加密命令:" + secret);
21+
System.out.println("加密命令:" + secret);
2222
} catch (IOException e) {
2323
}
2424
try {
2525
FileInputStream fis = new FileInputStream(file);
2626
DataInputStream inData = new DataInputStream(fis);
2727
String str = inData.readUTF();
2828
String mingwen = person.decrypt(str, password);
29-
System.out.println("解密命令:" + mingwen);
29+
System.out.println("解密命令:" + mingwen);
3030
} catch (IOException e) {
3131
}
3232
}

src/main/example10_12/ch10/例子13/Example10_13.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子13;
1+
package ch10.例子13;
22

33
import java.io.File;
44
import java.io.FileInputStream;
@@ -10,7 +10,7 @@
1010
public class Example10_13 {
1111
public static void main(String args[]) {
1212
TV changhong = new TV();
13-
changhong.setName("长虹电视");
13+
changhong.setName("长虹电视");
1414
changhong.setPrice(5678);
1515
File file = new File("television.txt");
1616
try {
@@ -22,14 +22,14 @@ public static void main(String args[]) {
2222
ObjectInputStream objectIn = new ObjectInputStream(fileIn);
2323
TV xinfei = (TV) objectIn.readObject();
2424
objectIn.close();
25-
xinfei.setName("新飞电视");
25+
xinfei.setName("新飞电视");
2626
xinfei.setPrice(6666);
27-
System.out.println("changhong的名字:" + changhong.getName());
28-
System.out.println("changhong的价格:" + changhong.getPrice());
29-
System.out.println("xinfei的名字:" + xinfei.getName());
30-
System.out.println("xinfei的价格:" + xinfei.getPrice());
27+
System.out.println("changhong的名字:" + changhong.getName());
28+
System.out.println("changhong的价格:" + changhong.getPrice());
29+
System.out.println("xinfei的名字:" + xinfei.getName());
30+
System.out.println("xinfei的价格:" + xinfei.getPrice());
3131
} catch (ClassNotFoundException event) {
32-
System.out.println("不能读出对象");
32+
System.out.println("不能读出对象");
3333
} catch (IOException event) {
3434
System.out.println(event);
3535
}

src/main/example10_12/ch10/例子13/TV.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子13;
1+
package ch10.Àý×Ó13;
22

33
import java.io.Serializable;
44

src/main/example10_12/ch10/例子14/Example10_14.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子14;
1+
package ch10.例子14;
22

33
import java.io.File;
44
import java.io.IOException;
@@ -14,17 +14,17 @@ public static void main(String args[]) {
1414
try {
1515
RandomAccessFile input = new RandomAccessFile(file, "rw");
1616
FileChannel channel = input.getChannel();
17-
FileLock lock = channel.tryLock(); // 加锁
18-
System.out.println("输入要读去的行数:");
17+
FileLock lock = channel.tryLock(); // 加锁
18+
System.out.println("输入要读去的行数:");
1919
while (scanner.hasNextInt()) {
2020
int m = scanner.nextInt();
21-
lock.release(); // 解锁
21+
lock.release(); // 解锁
2222
for (int i = 1; i <= m; i++) {
2323
String str = input.readLine();
2424
System.out.println(str);
2525
}
26-
lock = channel.tryLock(); // 加锁
27-
System.out.println("输入要读去的行数:");
26+
lock = channel.tryLock(); // 加锁
27+
System.out.println("输入要读去的行数:");
2828
}
2929
} catch (IOException event) {
3030
System.out.println(event);

src/main/example10_12/ch10/例子15/Example10_15.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子15;
1+
package ch10.Àý×Ó15;
22

33
import java.io.File;
44
import java.util.InputMismatchException;

src/main/example10_12/ch10/例子16/Example10_16.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package ch10.例子16;
1+
package ch10.Àý×Ó16;
22

33
import java.io.File;
44
import java.util.Scanner;
@@ -20,7 +20,7 @@ public static void main(String args[]) {
2020
System.out.println(score);
2121
}
2222
double aver = sum / count;
23-
System.out.println("平均成绩:" + aver);
23+
System.out.println("ƽ¾ù³É¼¨:" + aver);
2424
} catch (Exception exp) {
2525
System.out.println(exp);
2626
}

0 commit comments

Comments
 (0)