/** * Write model jar file with nullability model at DEFAULT_ASTUBX_LOCATION * * @param outPath Path of output model jar file. */ private static void writeModelJAR(String outPath) throws IOException { Preconditions.checkArgument( outPath.endsWith(MODEL_JAR_SUFFIX), "invalid model file path! " + outPath); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outPath)); if (!map_result.isEmpty()) { ZipEntry entry = new ZipEntry(DEFAULT_ASTUBX_LOCATION); // Set the modification/creation time to 0 to ensure that this jars always have the same // checksum entry.setTime(0); entry.setCreationTime(FileTime.fromMillis(0)); zos.putNextEntry(entry); writeModel(new DataOutputStream(zos)); zos.closeEntry(); } zos.close(); LOG(VERBOSE, "Info", "wrote model to: " + outPath); }
public void setTime(ZipEntry newInstance, ZipEntry oldInstance) { { FileTime time = oldInstance.getCreationTime(); if (time != null) { newInstance.setCreationTime(time); } } { FileTime time = oldInstance.getLastModifiedTime(); if (time != null) { newInstance.setLastModifiedTime(time); } } { FileTime time = oldInstance.getLastAccessTime(); if (time != null) { newInstance.setLastAccessTime(time); } } }
public void setCreationTime(@Nonnull Instant creationTime) { getHandle().setCreationTime(FileTime.from(creationTime)); }
public void setCreationTime(@Nonnull Instant creationTime) { getHandle().setCreationTime(FileTime.from(creationTime)); }
entry.setCreationTime(FileTime.fromMillis(file.toFile().lastModified())); entry.setComment("Created by TheCodersCorner"); zipStream.putNextEntry(entry);
/** * write ZIP faster without compress! */ final void writeTo(ZipOutputStream zos) throws IOException { ZipEntry outEntry = new ZipEntry(name); CRC32 crc32 = new CRC32(); crc32.update(bytes); outEntry.setCrc(crc32.getValue()); outEntry.setMethod(ZipEntry.STORED); outEntry.setSize(bytes.length); outEntry.setCompressedSize(bytes.length); outEntry.setLastAccessTime(ZERO); outEntry.setLastModifiedTime(ZERO); outEntry.setCreationTime(ZERO); zos.putNextEntry(outEntry); zos.write(bytes); }
public void setTime(ZipEntry newInstance, ZipEntry oldInstance) { { FileTime time = oldInstance.getCreationTime(); if (time != null) { newInstance.setCreationTime(time); } } { FileTime time = oldInstance.getLastModifiedTime(); if (time != null) { newInstance.setLastModifiedTime(time); } } { FileTime time = oldInstance.getLastAccessTime(); if (time != null) { newInstance.setLastAccessTime(time); } } }
private ZipEntry cloneEntry(ZipEntry entry) { ZipEntry newEntry = new ZipEntry(entry.getName()); newEntry.setTime(entry.getTime()); if (entry.getCreationTime() != null) { newEntry.setCreationTime(entry.getCreationTime()); } if (entry.getLastModifiedTime() != null) { newEntry.setLastModifiedTime(entry.getLastModifiedTime()); } if (entry.getLastAccessTime() != null) { newEntry.setLastAccessTime(entry.getLastAccessTime()); } newEntry.setComment(entry.getComment()); newEntry.setExtra(entry.getExtra()); return newEntry; } }