How:程序与文件之间的信息传递实现(File I/O)
来源:互联网 发布:单片机最小系统能干嘛 编辑:程序博客网 时间:2024/06/06 14:02
先来看一幅图:
说明:
①
PrintWriter与FileOutputStream:
PrintWriter Prints formatted representations of objects to a text-output stream.
FileOutputStream is meant for writing streams of raw bytes such as image data. For writing streams of characters, consider using FileWriter.
路径格式:
windows下:例如,C:\\dataFiles\\goodData\\data.txt或者C:/dataFiles/goodData/data.txt
UNIX/linux下:/user/sam/dataFiles/goodData/data.txt
建议斜杠都用类似于UNIX 格式的(因为通用)
⑤
超出会抛出异常NoSuchElementException;而BufferedReader返回特殊值
⑥
FileReader is meant for reading streams of characters. For reading streams of raw bytes, consider using a FileInputStream.
BufferedReader read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.
⑦
只有两个读取函数readeLine()和read();
⑧
PrintWriter的close()函数会调用flush()函数,后者会将缓存中的还未写入file的数据一次性全部写入
①②③④⑤⑥⑦⑨可通过官方文档获取更多函数介绍
- How:程序与文件之间的信息传递实现(File I/O)
- linux系统编程之文件与I/O(五):文件的内核结构file和dup实现重定向
- linux系统编程之文件与I/O(五):文件的内核结构file和dup实现重定向
- 同步 I/O 与异步 I/O 之间的差别
- 通过JNI 实现 java与C++之间的信息传递
- OpenCV中Matx与Mat之间的转换以及对XML和YAML文件实现I/O操作
- Linux文件I/O编程--文件描述符与打开文件之间的关系
- 文件I/O与标准I/O的区别
- innodb_flush_method 与 File I/O
- innodb_flush_method 与 File I/O
- innodb_flush_method 与 File I/O
- C++迭代器配接器(实现容器、文件、控制台之间的I/O )
- 文件与I/O
- 文件与I/O(-)
- 文件与I/O
- 文件I/O-009.set_fl()的实现
- 文件I/O-010.clr_fl()的实现
- I/O 操作文件的类——File
- Android复写BaseAdapter并显示ListView视图
- 工欲善其事,必先利其器
- Flex3 实战 10章 事件
- C_字符串 PK string
- LINQ查询技术
- How:程序与文件之间的信息传递实现(File I/O)
- 织梦(dede)注册会员时增加字段
- Java 数字输入的一个bug
- Bionic C Library Overview
- DataGridViewRow的Remove 与 DataRow的Remove区别
- hdoj 3035 War
- 大众点评面试题
- Delphi/C++Builder Maskedit控件的掩码说明
- 第九周任务二之time类流运算符的重载