Examples of Indent


Examples of org.linkedin.util.text.Indent

  /**
   * Constructor */
  public XMLIndent()
  {
    this(new Indent());
  }
View Full Code Here

Examples of org.osgi.service.indexer.impl.util.Indent

  public void index(Set<File> files, OutputStream out, Map<String, String> config) throws Exception {
    if (config == null)
      config = new HashMap<String, String>(0);
   
    Indent indent;
    PrintWriter pw;
    if (config.get(ResourceIndexer.PRETTY) != null) {
      indent = Indent.PRETTY;
      pw = new PrintWriter(out);
    } else {
      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }
   
    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
   
    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);
   
    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
   
    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
   
    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush(); pw.close();
  }
View Full Code Here

Examples of org.osgi.service.indexer.impl.util.Indent

  public void index(Set<File> files, OutputStream out, Map<String, String> config) throws Exception {
    if (config == null)
      config = new HashMap<String, String>(0);
   
    Indent indent;
    PrintWriter pw;
    if (config.get(ResourceIndexer.PRETTY) != null) {
      indent = Indent.PRETTY;
      pw = new PrintWriter(out);
    } else {
      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }
   
    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
   
    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);
   
    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
   
    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
   
    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush(); pw.close();
  }
View Full Code Here

Examples of org.osgi.service.indexer.impl.util.Indent

  public void index(Set<File> files, OutputStream out, Map<String, String> config) throws Exception {
    if (config == null)
      config = new HashMap<String, String>(0);
   
    Indent indent;
    PrintWriter pw;
    if (config.get(ResourceIndexer.PRETTY) != null) {
      indent = Indent.PRETTY;
      pw = new PrintWriter(out);
    } else {
      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }
   
    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
   
    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);
   
    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
   
    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
   
    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush(); pw.close();
  }
View Full Code Here

Examples of org.osgi.service.indexer.impl.util.Indent

  public void index(Set<File> files, OutputStream out, Map<String, String> config) throws Exception {
    if (config == null)
      config = new HashMap<String, String>(0);
   
    Indent indent;
    PrintWriter pw;
    if (config.get(ResourceIndexer.PRETTY) != null) {
      indent = Indent.PRETTY;
      pw = new PrintWriter(out);
    } else {
      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }
   
    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
   
    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);
   
    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
   
    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
   
    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush(); pw.close();
  }
View Full Code Here

Examples of org.osgi.service.indexer.impl.util.Indent

    Set<File> filesToIndex = new TreeSet<File>();
    if (files != null && !files.isEmpty()) {
      resolveDirectories(files, filesToIndex);
    }

    Indent indent;
    PrintWriter pw = null;
    try {
      String prettySetting = config.get(ResourceIndexer.PRETTY);
      String compressedSetting = config.get(ResourceIndexer.COMPRESSED);
      /**
       * <pre>
       * pretty   compressed         out-pretty     out-compressed
       *   null         null        Indent.NONE               true*
       *   null        false        Indent.NONE              false
       *   null         true        Indent.NONE               true
       *  false         null      Indent.PRETTY              false*
       *  false        false        Indent.NONE              false
       *  false         true        Indent.NONE               true
       *   true         null      Indent.PRETTY              false*
       *   true        false      Indent.PRETTY              false
       *   true         true      Indent.PRETTY               true
       *  
       *   * = original behaviour, before compressed was introduced
       * </pre>
       */
      indent = (prettySetting == null || (!Boolean.parseBoolean(prettySetting) && compressedSetting != null)) ? Indent.NONE : Indent.PRETTY;
      boolean compressed = (prettySetting == null && compressedSetting == null) || Boolean.parseBoolean(compressedSetting);
      if (!compressed) {
        pw = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
      } else {
        pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
      }

      pw.print(Schema.XML_PROCESSING_INSTRUCTION);
      Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);

      String repoName = config.get(REPOSITORY_NAME);
      if (repoName == null)
        repoName = REPOSITORYNAME_DEFAULT;
      repoTag.addAttribute(Schema.ATTR_NAME, repoName);

      String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
      if (increment == null)
        increment = Long.toString(System.currentTimeMillis());
      repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);

      repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);

      repoTag.printOpen(indent, pw, false);
      for (File file : filesToIndex) {
        try {
          Tag resourceTag = generateResource(file, config);
          resourceTag.print(indent.next(), pw);
        } catch (Exception e) {
          log(LogService.LOG_WARNING, MessageFormat.format("Could not index {0}, skipped ({1}).", file, e.getMessage()), null);
        }
      }
      repoTag.printClose(indent, pw);
View Full Code Here

Examples of org.osgi.service.indexer.impl.util.Indent

   */
  public void index(Set<File> files, OutputStream out, Map<String, String> config) throws Exception {
    if (config == null)
      config = new HashMap<String, String>(0);

    Indent indent;
    PrintWriter pw;
    if (config.get(ResourceIndexer.PRETTY) != null) {
      indent = Indent.PRETTY;
      pw = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
    } else {
      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }

    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);

    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);

    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);

    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);

    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush();
    pw.close();
  }
View Full Code Here

Examples of ucar.nc2.util.Indent

   * @param out   send output here.
   * @param ct    allow task to be cancelled; may be null.
   * @throws java.io.IOException on read error
   */
  static public void printArray(Array array, String name, PrintWriter out, CancelTask ct) throws IOException {
    printArray(array, name, null, out, new Indent(2), ct, true);
    out.flush();
  }
View Full Code Here

Examples of ucar.nc2.util.Indent

  }

  static public String printArray(Array array, String name, CancelTask ct) throws IOException {
    CharArrayWriter carray = new CharArrayWriter(100000);
    PrintWriter pw = new PrintWriter(carray);
    printArray(array, name, null, pw, new Indent(2), ct, true);
    return carray.toString();
  }
View Full Code Here

Examples of ucar.nc2.util.Indent

   * @param out   send output here.
   * @param sdata StructureData to print.
   * @throws java.io.IOException on read error
   */
  static public void printStructureData(PrintWriter out, StructureData sdata) throws IOException {
    printStructureData(out, sdata, new Indent(2), null);
    out.flush();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.