FileOutputStream写出数据 A:操作步骤 a:创建字节输出流对象 b:调用write()方法 publicvoid write(int b):写一个字节 publicvoid write(byte[] b):写一个字节数组 publicvoid write(byte[] b,int off,int len):写一个字节数组的一部分,从off序号开始写len个字节 c:释放资源 B:代码体现: FileOutputStreamfos = new FileOutputStream("fos.txt"); fos.write("hello".getBytes()); fos.close();
|