auto commit
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user