WinRar和ZipinputStream

时间:2015-03-15 15:39:23

标签: java winrar zipinputstream

我遇到了问题。 Myservice接受zip文件并坚持输入。我们也可以下载与zip相同的持久性条目。当我下载zip时,其压缩方法是“DEFLATED”。当我解压缩下载的zip并对其进行编辑并重新压缩并将其上传回来时,其压缩显示为“已存储”并且无法读取zip中的文件。请建议如何使用WINRAR“DEFLATION”方法压缩并上传。

 public static APIProxy build(final byte[] content) throws IOException, APIManagementServiceException {
    ZipInputStream zipInput = null;
    ByteArrayInputStream stream = null;
    APIProxy apiProxy = null;
    try {
      stream = new ByteArrayInputStream(Base64.decodeBase64(content));
      zipInput = new ZipInputStream(stream);
      ZipEntry entry = zipInput.getNextEntry();
      APIProxyZipEntity zipEntity = null;
      while (entry != null) {

        if (zipEntity == null) {
          zipEntity = getZipEntity(zipInput, entry, entityType);
        } else {
          setZipEntity(zipInput, entry, zipEntity, entityType);
        }
        entry = zipInput.getNextEntry();
      }
      setZipEntity(zipEntity);
      apiProxy = zipEntity == null ? null : zipEntity.getModel();
    } finally {
      ZipProcessorUtil.close(zipInput);
      ZipProcessorUtil.close(stream);
    }
    return apiProxy;
  }

0 个答案:

没有答案