简单实现IO读写

    xiaoxiao2021-03-25  70

    前言

        java利用封装好的jar包,实现IO读写操作。

    内容

    需求

        将indome里面的文字,读取并且写入到outdemo文件中

    demo

    /** * Created by zhou on 2017/3/8. */ public class MyIoDemo { public static void main (String args[]) throws IOException{ FileInputStream in = null; FileOutputStream out = null; try { //notice this "//" in = new FileInputStream("//C://Users//zhou//Desktop//indemo.txt"); out = new FileOutputStream("//C://Users//zhou//Desktop//outdemo.txt"); int c; while ((c = in.read()) != -1) { out.write(c); } System.out.println(out); System.out.println("success!"); }finally { { if(in != null) { in.close(); } if (out != null) { out.close(); } } } } }

    效果图

    小结

        革命尚未成功,还得努力啊!

    感谢您的宝贵时间···

    转载请注明原文地址: https://ju.6miu.com/read-17989.html

    最新回复(0)