zoukankan      html  css  js  c++  java
  • FileOutputStream和FileInputStream

    public class Filetest {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            File file = new File("word.txt");
            try {
                FileOutputStream out = new FileOutputStream(file);
                byte buy[] = "我是一只小毛驴,我从来也不骑。".getBytes();
                out.write(buy);
                out.close();
            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
            
            try {
                FileInputStream in = new FileInputStream(file);
                byte byt[] = new byte[1024];
                int len = in.read(byt);
                System.out.print(new String(byt,0,len));
                in.close();
            } catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }
        }
    }
  • 相关阅读:
    柱状图最大的矩形
    单词搜索
    最小覆盖子串
    颜色分类
    编辑距离
    X的平方根
    二进制求和
    最大子序和
    N皇后
    java8-14-时间API
  • 原文地址:https://www.cnblogs.com/dulute/p/10570196.html
Copyright © 2011-2022 走看看