title: How to Zip a given set of files in java
body: <p>I want to Zip a set of files given the location of the set of files.</p>
  
  <p>Send that Zip file to the below-mentioned method</p>
  
  <pre><code>private StreamingOutput buildStreamingOutput(final File pdfFile, final boolean isGeneratedPdf) {
          return new StreamingOutput() {
              @Override
              public void write(OutputStream output) throws IOException, WebApplicationException {
                  java.nio.file.Path path = Paths.get(pdfFile.getAbsolutePath());
                  byte[] data = CryptoUtil.decryptAsByteArray(path);
                  output.write(data);
                  output.flush();
                  output.close();
                  if (isGeneratedPdf) {
                      pdfFile.delete();
                  }
              }
          };
      }
  </code></pre>
  
  <p>Is it possible to zip files and send that Zip file as file(File.class)</p>