java基础之I/O操作

直接上代码:

import java.io.*;

class Test{
    public static void main(String[] args){
        FileInputStream inputfile = null;
        FileOutputStream outputfile = null;
        try{
            inputfile = new FileInputStream("./input.txt");
            outputfile = new FileOutputStream("./output.txt");
            byte[] buffer = new byte[100];
            int temp = inputfile.read(buffer,0,buffer.length);
            String s = new String(buffer);
            s = s.trim();
            System.out.println(s);
            outputfile.write(buffer,0,temp);
            
        }
        catch(Exception e){
            System.out.println(e);
        }
        
    }
}

 

上一篇:python-----csv文件


下一篇:php – Yii2 – 以一种形式保存多个相关的ActiveRecord模型