fileutils.java
来自「anewssystem新闻发布系统集成使用了spring hibernate f」· Java 代码 · 共 28 行
JAVA
28 行
package anni.tools;
import java.io.*;
public class FileUtils {
public static void copy(String src, String dest) throws Exception {
copy(new File(src), new File(dest));
}
public static void copy(File src, File dest) throws Exception {
if (!dest.getParentFile().exists()) {
dest.getParentFile().mkdirs();
}
FileInputStream fis = new FileInputStream(src);
FileOutputStream fos = new FileOutputStream(dest);
byte[] b = new byte[1024];
int len = 0;
while ((len = fis.read(b, 0, 1024)) != -1) {
fos.write(b, 0, len);
}
fos.flush();
fos.close();
fis.close();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?