Commons IO 用法举例
来源:互联网 发布:php 虚拟主机ip配置 编辑:程序博客网 时间:2024/06/06 08:23
public class TestCommonsio { /** * 测试 commons-io 读取文件 * 关注 FileUtils.readLines 方法 */ @Test public void test01() throws IOException { File file = new File("testCommonsIoFile.txt"); List<String> lines = FileUtils.readLines(file); int i=0; for(String str:lines){ i++; System.out.println("第 " + i + " 行数据为:\t" + str); } } /** * 关注 FileUtils.writeStringToFile 方法 * @throws IOException */ @Test public void test02() throws IOException { String str = "5555555555555555555555"; String ENTER = "\n"; // \\ 表示路径 File file = new File("testio\\testWriteStringToFile.txt"); // /** * 每输入一行以后,加上一个换行符 * * 参数 1:文件 * 参数 2:写入文件的字符串 * 参数 3: true 表示追加,加在后面 */ FileUtils.writeStringToFile(file,str+ENTER,true); }}
0 0
- Commons IO 用法举例
- commons-io jar包用法
- 工具类commons-io的FilenameUtils用法
- Commons之Commons-io
- Commons之Commons-io
- Commons IO
- Commons IO
- Apache Commons IO工具包
- Apache commons IO
- fileupload commons-io 下载
- Apache Commons IO工具包
- Commons IO使用
- commons io上传文件
- Apache Commons IO简介
- org.apache.commons.io
- Apache commons IO简介
- commons-io使用笔记
- IO commons 学习 (- )。
- 深入Android MediaPlayer的使用方法详解
- WordPress 取消上传2M限制
- 57.Automatic Shared Memory Management is disabled for your database instance. You realize that there
- 算法学习(数据结构)-程序员必回
- Android Plugin 插件化技术-Small插件框架
- Commons IO 用法举例
- MSM8976平台概述
- struts2中<s:select>标签的使用
- VB程序学习代码记录20160723(2)
- C++ 控制台窗口隐藏及其代码 【网上摘抄,方便查询】
- <s:iterator>的status属性
- Linux 下载与安装MongoDB
- 如何在 Linux 上录制你的终端操作
- 从今天开始,开始新的学习路程