@Override @SuppressWarnings("AccessingNonPublicFieldOfAnotherObject") public ZipEntry clone() { final ZipEntry entry; try { entry = (ZipEntry) super.clone(); } catch (CloneNotSupportedException ex) { throw new AssertionError(ex); } final ExtraFields fields = this.fields; entry.fields = fields == null ? null : fields.clone(); return entry; }
/** * Constructs a new ZIP entry with the given name and all other properties * copied from the given template. */ @SuppressWarnings("AccessingNonPublicFieldOfAnotherObject") protected ZipEntry(final String name, final ZipEntry template) { UShort.check(name.length()); this.init = template.init; this.name = name; this.platform = template.platform; this.general = template.general; this.method = template.method; this.dtime = template.dtime; this.crc = template.crc; this.csize = template.csize; this.size = template.size; this.eattr = template.eattr; this.offset = template.offset; final ExtraFields templateFields = template.fields; this.fields = templateFields == null ? null : templateFields.clone(); this.comment = template.comment; }
private byte[] getExtraFields(final boolean zip64) { ExtraFields fields = this.fields; if (zip64) { final ExtraField field = composeZip64ExtraField(); if (null != field) { fields = null != fields ? fields.clone() : new ExtraFields(); fields.add(field); } } else { assert null == fields || null == fields.get(ZIP64_HEADER_ID); } return null == fields ? EMPTY : fields.getExtra(); }