use of com.facebook.buck.zip.CustomZipEntry in project buck by facebook.
the class CachingBuildEngineTest method writeEntriesToZip.
private static void writeEntriesToZip(Path file, ImmutableMap<Path, String> entries) throws IOException {
try (CustomZipOutputStream zip = ZipOutputStreams.newOutputStream(file)) {
for (Map.Entry<Path, String> mapEntry : entries.entrySet()) {
CustomZipEntry entry = new CustomZipEntry(mapEntry.getKey());
// We want deterministic ZIPs, so avoid mtimes. -1 is timzeone independent, 0 is not.
entry.setTime(ZipConstants.getFakeTime());
// We set the external attributes to this magic value which seems to match the attributes
// of entries created by {@link InMemoryArtifactCache}.
entry.setExternalAttributes(33188L << 16);
zip.putNextEntry(entry);
zip.write(mapEntry.getValue().getBytes());
zip.closeEntry();
}
}
}
Aggregations