auto commit

This commit is contained in:
CyC2018
2018-08-05 17:37:04 +08:00
parent eace8369dd
commit 1366a2e149
2 changed files with 21 additions and 17 deletions

View File

@ -60,15 +60,18 @@ public static void listAllFiles(File dir) {
```java
public static void copyFile(String src, String dist) throws IOException {
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dist);
byte[] buffer = new byte[20 * 1024];
// read() 最多读取 buffer.length 个字节
// 返回的是实际读取的个数
// 返回 -1 的时候表示读到 eof即文件尾
while (in.read(buffer, 0, buffer.length) != -1) {
out.write(buffer);
}
in.close();
out.close();
}
@ -165,20 +168,17 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
System.out.println(a2);
}
private static class A implements Serializable
{
private static class A implements Serializable {
private int x;
private String y;
A(int x, String y)
{
A(int x, String y) {
this.x = x;
this.y = y;
}
@Override
public String toString()
{
public String toString() {
return "x = " + x + " " + "y = " + y;
}
}