Package org.jastadd.util

Examples of org.jastadd.util.PrettyPrinter


   * @param file
   * @throws FileNotFoundException
   */
  public void writeTo(File file) throws IOException {
    PrintStream out = new PrintStream(new FileOutputStream(file));
    PrettyPrinter pp = new PrettyPrinter("  ", out);
    pp.print(json());
    out.close();
  }
View Full Code Here


  /**
   * Load the scene description from a JSON file.
   * @param out output stream - will be closed
   */
  public void saveDescription(OutputStream out) throws IOException {
    PrettyPrinter pp = new PrettyPrinter("  ", new PrintStream(out));
    toJson().prettyPrint(pp);
    out.close();
  }
View Full Code Here

  }

  private static void writeSceneJson(File file, JsonObject desc) throws IOException {
    FileOutputStream out = new FileOutputStream(file);
    try {
      PrettyPrinter pp = new PrettyPrinter("  ", new PrintStream(out));
      desc.prettyPrint(pp);
    } finally {
      out.close();
    }
View Full Code Here

    version.add("libraries", libraries);
    JarEntry entry = new JarEntry("version.json");
    entry.setTime(System.currentTimeMillis());
    jar.putNextEntry(entry);
    PrintStream out = new PrintStream(jar);
    PrettyPrinter pp = new PrettyPrinter("  ", out);
    version.prettyPrint(pp);
    out.flush();
    jar.closeEntry();

    File latest = new File("latest.json");
    out = new PrintStream(new FileOutputStream(latest));
    version.prettyPrint(new PrettyPrinter("  ", out));
    out.close();
  }
View Full Code Here

   */
  public void save(File file) {
    String path = file.getAbsolutePath();
    try {
      OutputStream out = new FileOutputStream(file);
      PrettyPrinter pp = new PrettyPrinter("  ", new PrintStream(out));
      json.prettyPrint(pp);
      out.close();
      if (System.getProperty("log4j.logLevel", "WARN").equals("INFO")) {
        System.out.println("Saved settings to " + path);
      }
View Full Code Here

TOP

Related Classes of org.jastadd.util.PrettyPrinter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.