java解压rar
public static void unrar(String source, String dest) throws IOException {
IInArchive archive;
RandomAccessFile randomAccessFile;
// 第一个参数是需要解压的压缩包路径,第二个参数参考JdkAPI文档的RandomAccessFile
//r代表以只读的方式打开文本,也就意味着不能用write来操作文件
randomAccessFile = new RandomAccessFile(source, "r");
archive = SevenZip.openInArchive(null, // null - autodetect
new RandomAccessFileInStream(randomAccessFile));
int[] in = new int[archive.getNumberOfItems()];
for (int i = 0; i < in.length; i++) {
in[i] = i;
}
archive.extract(in, false, new RarExtractCallback(archive, new File(dest).getAbsolutePath() + "/"));
archive.close();
randomAccessFile.close();
}