写文件
2017-12-05 本文已影响0人
低至一折起
public static void main(String[] args) throws IOException {
// 获取文件流
InputStream fis= new FileInputStream("D:\\桌面\\111\\111.txt");
int index;
byte[] bytes = new byte[1024];
FileOutputStream fos= new FileOutputStream("D:\\桌面\\111\\222.txt");
while ((index = fis.read(bytes)) != -1) {
fos.write(bytes, 0, index);
fos.flush();
}
fos.close();
fis.close();
}