コード例 #1
0
 /**
  * Sets the central directory part of extra fields.
  *
  * @param b an array of bytes to be parsed into extra fields
  */
 public void setCentralDirectoryExtra(byte[] b) {
   try {
     ZipExtraField[] central =
         ExtraFieldUtils.parse(b, false, ExtraFieldUtils.UnparseableExtraField.READ);
     mergeExtraFields(central, false);
   } catch (ZipException e) {
     throw new RuntimeException(e.getMessage(), e);
   }
 }
コード例 #2
0
 /**
  * Parses the given bytes as extra field data and consumes any unparseable data as an {@link
  * UnparseableExtraFieldData} instance.
  *
  * @param extra an array of bytes to be parsed into extra fields
  * @throws RuntimeException if the bytes cannot be parsed
  * @throws RuntimeException on error
  */
 @Override
 public void setExtra(byte[] extra) throws RuntimeException {
   try {
     ZipExtraField[] local =
         ExtraFieldUtils.parse(extra, true, ExtraFieldUtils.UnparseableExtraField.READ);
     mergeExtraFields(local, true);
   } catch (ZipException e) {
     // actually this is not possible as of Commons Compress 1.1
     throw new RuntimeException(
         "Error parsing extra fields for entry: " + getName() + " - " + e.getMessage(), e);
   }
 }