bytes.add(JarReader.readFileFromJarAtURL(jarFileName.getAbsolutePath(), file));
}
// Write everything from the old jar except the catalog to the same
// file with JarBuilder.
JarBuilder builder = new JarBuilder(null);
for (int i = 0; i < files.size(); ++i) {
String file = files.get(i);
if (file.equals(CatalogUtil.CATALOG_FILENAME)) {
builder.addEntry(CatalogUtil.CATALOG_FILENAME,
catalog.serialize().getBytes());
}
else {
builder.addEntry(file, bytes.get(i));
}
}
// Add any additions that they want to the root of the the jar structure
for (File f : additions) {
if (f != null) {
builder.addEntry(f.getName(), FileUtil.readBytesFromFile(f.getAbsolutePath()));
}
} // FOR
builder.writeJarToDisk(jarFileName.getAbsolutePath());
}