// 复制文件内容
static void copy(String source, String target) throws IOException {
try (InputStream input = new FileInputStream(source);
OutputStream output = new FileOutputStream(target))
{
input.transferTo(output); // transferTo的作用是复制
}
Sign in to make a reply
jasmine
// 复制文件内容
static void copy(String source, String target) throws IOException {
try (InputStream input = new FileInputStream(source);
OutputStream output = new FileOutputStream(target))
{
input.transferTo(output); // transferTo的作用是复制
}
}