写文件

160 阅读1分钟
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();  
	}

转载自: 简书 - 低至一折起

文章:www.jianshu.com/p/d30869838…