Examples of Formatter


Examples of java.util.Formatter

  public final double score() {
    return score;
  }
 
  public final String score( int digits ) {
    return new Formatter( new StringBuilder() ).format( "%." + digits + "f", Double.valueOf( score ) ).out().toString();
  }
View Full Code Here

Examples of java.util.Formatter

    try {
      factory = (T) Class.forName(path).newInstance();

    } catch (final Exception e) {

      final Formatter out = new Formatter();

      logger.error(out.format("Unable to load factory class [%s]", path)
          .toString());

//      throw new IllegalStateException(e);
    }
  }
View Full Code Here

Examples of java.util.Formatter

   * this instance of the Java virtual machine.
   * </P>
   */
  public PacketFormatter() {
    JNetStreamInitializer.init();
    this.platformFormatter = new Formatter();
    this.out = this.platformFormatter.out();
    this.locale = this.platformFormatter.locale();
    this.delagate = PacketFormatter.registry.get(
        PacketFormatter.DEFAULT_FORMAT_TYPE).newInstance(
        this.platformFormatter, this.out, this.locale);
View Full Code Here

Examples of java.util.Formatter

   *          Destination for the formatted output. If a is null then a
   *          StringBuilder will be created.
   */
  public PacketFormatter(final Appendable a) {
    JNetStreamInitializer.init();
    this.platformFormatter = new Formatter(a);
    this.out = a;
    this.locale = this.platformFormatter.locale();
    this.delagate = PacketFormatter.registry.get(
        PacketFormatter.DEFAULT_FORMAT_TYPE).newInstance(
        this.platformFormatter, this.out, this.locale);
View Full Code Here

Examples of java.util.Formatter

   *          The locale to apply during formatting. If l is null then no
   *          localization is applied.
   */
  public PacketFormatter(final Appendable a, final Locale l) {
    JNetStreamInitializer.init();
    this.platformFormatter = new Formatter(a, l);
    this.out = a;
    this.locale = l;
    this.delagate = PacketFormatter.registry.get(
        PacketFormatter.DEFAULT_FORMAT_TYPE).newInstance(
        this.platformFormatter, this.out, this.locale);
View Full Code Here

Examples of java.util.Formatter

    this.delagate = this;
  }

  public PacketFormatter(final FormatterType formatType) {
    JNetStreamInitializer.init();
    this.platformFormatter = new Formatter();
    this.out = this.platformFormatter.out();
    this.locale = this.platformFormatter.locale();
    this.delagate = PacketFormatter.registry.get(formatType).newInstance(
        this.platformFormatter, this.out, this.locale);
  }
View Full Code Here

Examples of java.util.Formatter

  }

  public PacketFormatter(final FormatterType formatType, final Appendable a) {
    JNetStreamInitializer.init();
    this.out = a;
    this.platformFormatter = new Formatter(a);
    this.locale = this.platformFormatter.locale();
    this.delagate = PacketFormatter.registry.get(formatType).newInstance(
        this.platformFormatter, this.out, this.locale);
  }
View Full Code Here

Examples of java.util.Formatter

  public PacketFormatter(final FormatterType formatType, final Appendable a,
      final Locale l) {
    JNetStreamInitializer.init();
    this.out = a;
    this.locale = l;
    this.platformFormatter = new Formatter(a, l);
    this.delagate = PacketFormatter.registry.get(formatType).newInstance(
        this.platformFormatter, this.out, this.locale);
  }
View Full Code Here

Examples of java.util.Formatter

        if (this.length == 1)
            suffix = "";
        else
            suffix = "s";
        final StringBuilder sb = new StringBuilder();
        final Formatter formatter = new Formatter(sb, Locale.US);
        formatter.format("%d %s%s", this.length, this.units.getLongFormat(),
                suffix);
        return sb.toString();
    }
View Full Code Here

Examples of java.util.Formatter

    /**
     * Output periods in short format (e.g. "2w")
     */
    private String getInternalShortFormat() {
        final StringBuilder sb = new StringBuilder();
        final Formatter formatter = new Formatter(sb, Locale.US);
        formatter.format("%d%s", this.length, this.units.getShortFormat());
        return sb.toString();
    }
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.