首页 > 编程语言 > 详细

java基础之I/O操作

时间:2019-11-13 00:40:57      阅读:98      评论:0      收藏:0      [点我收藏+]

直接上代码:

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);
        }
        
    }
}

 

java基础之I/O操作

原文:https://www.cnblogs.com/endust/p/11846040.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!