public void testCpioUnarchive() throws Exception {
final StringBuilder expected = new StringBuilder();
expected.append("./test1.xml<?xml version="1.0"?>
");
expected.append("<empty/>./test2.xml<?xml version="1.0"?>
");
expected.append("<empty/>
");
final CpioArchiveInputStream in = new CpioArchiveInputStream(new FileInputStream(getFile("bla.cpio")));
CpioArchiveEntry entry;
final StringBuilder result = new StringBuilder();
while ((entry = (CpioArchiveEntry) in.getNextEntry()) != null) {
result.append(entry.getName());
int tmp;
while ((tmp = in.read()) != -1) {
result.append((char) tmp);
}
}
in.close();
assertEquals(result.toString(), expected.toString());
}
|