Example #1
0
  public static void exportWithProperties(String propFile, String outFile) throws IOException {
    Properties props = new Properties();
    try {
      props.load(new FileInputStream(propFile));
    } catch (FileNotFoundException e) {
      System.err.println("Property file not found: " + propFile);
      System.exit(2);
    } catch (IOException e) {
      System.err.println("Unable to read properties: " + propFile);
      System.exit(2);
    }

    OutputStream out = null;

    try {
      out = new BufferedOutputStream(new FileOutputStream(outFile));
      WikiEngine engine = new WikiEngine(props);

      Exporter x = new Exporter(out, true);

      x.export(engine);
    } catch (WikiException e) {
      // TODO Auto-generated catch block
      e.printStackTrace(System.err);
      System.exit(3);
    } catch (IOException e) {
      e.printStackTrace(System.err);
      System.exit(3);
    } finally {
      if (out != null) out.close();

      // Make sure JSPWiki dies too
      System.exit(0);
    }
  }
Example #2
0
  /**
   * This is a special version of the routine which knows the FileSystemProvider default format.
   *
   * @param dir
   * @param outFile
   * @throws IOException
   */
  public static void exportWithDir(String dir, String outFile) throws IOException {
    FileOutputStream out = new FileOutputStream(new File(outFile));
    Exporter x = new Exporter(out, true);

    x.export(dir);

    out.close();
  }