我正在寻找一种在java运行时读取RPM内容的方法.
有人建议使用7zip在运行时解压缩和/或提取RPM,使用7zip的系统命令.
该解决方案有两个缺点:
有任何想法吗?
编辑:
我正试着走下罗伯特的道路.这是我的代码:
String file = "MyRpm.rpm";
CpioArchiveInputStream cpioIn =
new CpioArchiveInputStream( new FileInputStream(new File(file)) );
CpioArchiveEntry cpioEntry;
while ((cpioEntry = cpioIn.getNextEntry()) != null)
{
System.out.println(cpioEntry.getName());
int tmp;
StringBuffer buf = new StringBuffer();
while ((tmp = cpioIn.read()) != -1)
{
buf.append((char) tmp);
}
System.out.println(buf.toString());
}
cpioIn.close();
Run Code Online (Sandbox Code Playgroud)
我得到一个例外:( java.io.IOException: Unknown magic [????有趣的字符来自原始的错误消息).
| 归档时间: |
|
| 查看次数: |
1202 次 |
| 最近记录: |