zoukankan      html  css  js  c++  java
  • Java 字节流读写文件

    import java.io.*;
    class Test{
    public static void main(String args[]){
    FileInputStream fis = null;
    FileOutputStream fos = null;
    byte[] buffer = new byte[100];
    int temp = 0;
    try{
    fis = new FileInputStream("D:/wenhao/src/from.txt");
    fos = new FileOutputStream("D:/wenhao/src/to.txt");
    while(true){
    temp = fis.read(buffer,0,buffer.length);
    if(temp == -1){
    break;
    }
    fos.write(buffer,0,temp);
    }
    }
    catch(Exception e){
    System.out.println(e);
    }
    finally{
    try{
    fis.close();
    fos.close();
    }
    catch(Exception e2){
    System.out.println(e2);
    }
    }

    }
    }
  • 相关阅读:
    FormData的使用
    数据绑定
    DOM的映射机制
    leetcode750
    leetcode135
    leetcode41
    leetcode269
    leetcode253
    leetcode42
    leetcode48
  • 原文地址:https://www.cnblogs.com/hnrainll/p/2300887.html
Copyright © 2011-2022 走看看