- 软件介绍
- 软件截图
commons-io-2.4.jar包是Commons项目中用来处理IO流的一些工具类包,使用commons-io.jar包可以帮助开发的框架思路,马上下载commons-io-2.4.jar使用吧。
文件说明
Commons项目中用来处理IO的一些工具类包commons-io.jar
用法介绍
//直接将IO流转成字符串
InputStream in = new URL( http://jakarta.apache.org ).openStream();
try {
System.out.println( IOUtils.toString( in ) );
} finally {
IOUtils.closeQuietly(in);
}
//读取文本文件的所有行
File file = new File(/commons/io/project.properties);
List lines = FileUtils.readLines(file, UTF-8);
//路径处理
String filename = C:/commons/io/../lang/project.xml;
String normalized = FilenameUtils.normalize(filename);
// result is C:/commons/lang/project.xml
//获取目录空间
long freeSpace = FileSystemUtils.freeSpace(C:/);
//打印文件的所有行
LineIterator it = FileUtils.lineIterator(file, UTF-8);
try {
while (it.hasNext()) {
String line = it.nextLine();
/// do something with line
}
} finally {
LineIterator.closeQuietly(iterator);
}
commons-io-2.4.jar文件说明
Commons项目中用来处理IO的一些工具类包commons-io.jar
commons-io-2.4.jar用法介绍
//直接将IO流转成字符串
InputStream in = new URL( "http://jakarta.apache.org" ).openStream();
try {
System.out.println( IOUtils.toString( in ) );
} finally {
IOUtils.closeQuietly(in);
}
//读取文本文件的所有行
File file = new File("/commons/io/project.properties");
List lines = FileUtils.readLines(file, "UTF-8");
//路径处理
String filename = "C:/commons/io/../lang/project.xml";
String normalized = FilenameUtils.normalize(filename);
// result is "C:/commons/lang/project.xml"
//获取目录空间
long freeSpace = FileSystemUtils.freeSpace("C:/");
//打印文件的所有行
LineIterator it = FileUtils.lineIterator(file, "UTF-8");
try {
while (it.hasNext()) {
String line = it.nextLine();
/// do something with line
}
} finally {
LineIterator.closeQuietly(iterator);
}