Java IO操作

111

        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("fos.txt", true);
            for (int i = 0; i < 5; i++) {
                fos.write("hello".getBytes());
                fos.write("\r\n".getBytes());
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        } finally {
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

 

上一篇:java学习(150):文本缓冲流


下一篇:java JVM-自定加密和解密类加载器