Discuss / Java / 直接使用transferTo函数

直接使用transferTo函数

Topic source
static void copy(String source, String target) throws IOException {
		// 友情提示:测试时请使用无关紧要的文件
		// TODO:
		try (InputStream input = new FileInputStream(source); OutputStream output = new FileOutputStream(target)) {
			input.transferTo(output);
		}
	}

  • 1

Reply