code: public void writePackage(OutputStream output, String group, String name, String version)
              throws IOException, RepositoryException {
  
          String root = "jcr_root";
          ZipOutputStream zipStream = new ZipOutputStream(output);
          writeProperties(zipStream, group, name, version);
          writeFilter(zipStream);
          writeParents(zipStream, root, resource.getParent());
          writeZip(zipStream, root, true);
          zipStream.flush();
          zipStream.close();
      }
docs: Package output