Java IO操作
Posted kikyoqiang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java IO操作相关的知识,希望对你有一定的参考价值。
111
private static void FileInputStream() throws IOException FileInputStream fis = new FileInputStream("fos.txt"); // int by = fis.read(); // System.out.println(by); // System.out.println((char) by); // // by = fis.read(); // System.out.println(by); // System.out.println((char) by); // int by = fis.read(); // while (by != -1) // System.out.print((char) by); // by = fis.read(); // int by; while ((by = fis.read()) != -1) System.out.println((char) by); fis.close(); private static void FileOutputStream() 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 IO操作的主要内容,如果未能解决你的问题,请参考以下文章