Java 解压rar文件的经典实例
2009-11-11 18:06:09
/**
*
* @author Ice*
*/
public class RarUtil{
public static void main(String args[]) throws Exception {
String compress = "D:\\test.rar";// rar压缩文件
String decompression = "D:\\";// 解压路径
unZip(compress, decompression);
}
/**
* 解压
*
* @param compress
* rar压缩文件
* @param decompression
* 解压路径
*/
public static void unZip(String compress, String decompression) throws Exception {
java.lang.Runtime rt = java.lang.Runtime.getRuntime();
Process p = rt.exec("C:\\Program Files\\WinRAR\\UNRAR.EXE x -o+ -p- " + compress + " " + decompression);
StringBuffer sb = new StringBuffer();
java.io.InputStream fis = p.getInputStream();
int value = 0;
while ((value = fis.read()) != -1)
{
sb.append((char) value);
}
fis.close();
String result = new String(sb.toString().getBytes("ISO-8859-1"), "GBK");
System.out.println(result);
}
}
相关文档:
http://hi.baidu.com/skeryl/blog/item/d9b74e081e1d423ae92488ac.html
如果应用程序需要动态生成 PDF 文档,则需要 iText 库。开放源码的 iText 库使 PDF 文档的创建能够在瞬间完成。本文介绍了 iText 并提供了使用它从 Java ? 技术应用程序生成 PDF 文档的由浅入深的指南。我们创建了一个示例应用程序以更好地理解 ......
1 Boolean VS boolean
public final class Booleanextends [url=file:///G:/html_zh_CN/html/zh_CN/api/java/lang/Object.html]Object[/url]implements [url=file:///G:/html_zh_CN/html/zh_CN/api/java/io/Serializable.html]Serializable[/url], [url=file:///G:/html_zh_CN/html/zh_CN/api/java/lang ......
package com.chinacache.boss.queryservice.service.impl;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.chinacache.boss.queryservice.excepti ......
來源:http://blog.csdn.net/loyoveui/archive/2007/06/22/1662154.aspx
package test;
import java.lang.reflect.Method;
public class InvokeTest {
/**
*
* main 方法
* @param args
* void
*/
public static v ......