code: private static void unpackFile(InputStream in, File file) {
          byte[] buffer = new byte[4096];
  
          try {
              OutputStream out = new FileOutputStream(file);
              int read;
              while ((read = in.read(buffer)) != -1) {
                  out.write(buffer, 0, read);
              }
              out.close();
          } catch (IOException e) {
              throw new RuntimeException(e);
          }
      }
docs: Write the contents of an InputStream to a file
  @param in the input stream to read
  @param file the File to write to