标签:
import java.io.FileInputStream; import java.io.FileOutputStream; /** * @author czchina * */ public class TestStream { public static void main(String[] args){ FileInputStream fis = null; FileOutputStream fos =null; try{ fis = new FileInputStream("E:/Android/AndroidStudioProjects/text.txt"); fos = new FileOutputStream("E:/Android/AndroidStudioProjects/store.txt"); //生成一个字节数组 byte [] buffer= new byte [500]; while(true){ int tmp = fis.read(buffer,0,buffer.length); if(-1 == tmp){ System.out.print("Read complete ! \n"); break; } fos.write(buffer,0,tmp); } } catch(Exception e){ System.out.println(e); } finally{ try{ fis.close(); fos.close(); } catch(Exception e){ System.out.println(e); } } } }
console:
标签:
原文地址:http://www.cnblogs.com/plant/p/4637628.html