/** * @throws IllegalArgumentException if the serialized extra fields do not * conform to the ZIP File Format Specification. */ private void setExtraFields(final byte[] buf, final boolean zip64) throws IllegalArgumentException { assert UShort.check(buf.length); if (0 < buf.length) { final ExtraFields fields = new ExtraFields(); try { fields.readFrom(buf, 0, buf.length); if (zip64) parseZip64ExtraField(fields); } catch (final IndexOutOfBoundsException ex) { throw new IllegalArgumentException(ex); } fields.remove(ZIP64_HEADER_ID); this.fields = 0 < fields.size() ? fields : null; } else { this.fields = null; } }