boolean found = ArchiveWalker.walkControl(deb, new ArchiveVisitor<TarArchiveEntry>() {
public void visit(TarArchiveEntry entry, byte[] content) throws IOException {
assertFalse("directory found in the control archive", entry.isDirectory());
assertTrue("prefix", entry.getName().startsWith("./"));
InformationInputStream infoStream = new InformationInputStream(new ByteArrayInputStream(content));
IOUtils.copy(infoStream, NullOutputStream.NULL_OUTPUT_STREAM);
if (infoStream.isShell()) {
assertTrue("Permissions on " + entry.getName() + " should be 755", entry.getMode() == 0755);
} else {
assertTrue("Permissions on " + entry.getName() + " should be 644", entry.getMode() == 0644);
}
assertTrue(entry.getName() + " doesn't have Unix line endings", infoStream.hasUnixLineEndings());
assertEquals("user", "root", entry.getUserName());
assertEquals("group", "root", entry.getGroupName());
}
});