code: protected InputStream getInputStreamToLicenseInsideZip(final ZipInputStream zis, final String assetId, final String attachmentId) throws IOException {
          InputStream is = null;
          try {
              ZipEntry ze = zis.getNextEntry();
              while (ze != null) {
                  if (ze.isDirectory()) {
                      //do nothing
                  } else {
                      String name = getName(ze.getName().replace("/", File.separator));
                      String licId = assetId.concat(String.format("#licenses" + File.separator + "%s", name));
                      if (licId.equals(attachmentId)) {
                          ByteArrayOutputStream baos = new ByteArrayOutputStream();
                          byte[] buffer = new byte[1024];
                          int read;
                          int total = 0;
                          while ((read = zis.read(buffer)) != -1) {
                              baos.write(buffer, 0, read);
                              total += read;
                          }
                          //ZipEntry sometimes returns -1 when unable to get original size, in this case we want to proceed
                          if (ze.getSize() != -1 && total != ze.getSize()) {
                              throw new IOException("The size of the retrieved license was wrong. Expected : " + ze.getSize()
                                                    + " bytes, but actually was " + total + " bytes.");
                          }
  
                          byte[] content = baos.toByteArray();
                          is = new ByteArrayInputStream(content);
                      }
                  }
                  ze = zis.getNextEntry();
              }
          } finally {
              zis.closeEntry();
              zis.close();
          }
  
          return is;
  
      }
docs: Given a ZipInputStream to an asset within the repo get an input stream to the license attachment within the
  asset.
  
  @param zis ZipInputStream to the container for the asset (i.e. ZipInputStream to an ESA file inside a repo).
  @param assetId The id of the asset
  @param attachmentId The id of the license to get an input stream to.
  @return
  @throws IOException