Examples of format()


Examples of java.io.PrintStream.format()

    /**
     * @tests java.io.PrintStream#format(java.lang.String, java.lang.Object...)
     */
    public void test_formatLjava_lang_String$Ljava_lang_Object() {
        PrintStream os = new PrintStream(bos, false);
        os.format("%s %s", "Hello", "World");
        os.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        byte[] rbytes = new byte[11];
        bis.read(rbytes, 0, rbytes.length);
        assertEquals("Wrote incorrect string", "Hello World",
View Full Code Here

Examples of java.io.PrintWriter.format()

        {
            String path = library.toClientURL();

            paths.put(path);

            writer.format("\n/* %s */;\n", path);

            streamLibraryContent(library, stream);
        }

        writer.format("\n;/**/\nTapestry.markScriptLibrariesLoaded(%s);\n", paths);
View Full Code Here

Examples of java.text.ChoiceFormat.format()

            cf = new ChoiceFormat(limits, formats);
        } catch (Exception foo) {
            logln("ChoiceFormat constructor should check for the array lengths");
            cf = null;
        }
        if (cf != null) errln(cf.format(5));
    }

    /* @bug 4106660
     * ChoiceFormat.ctor(double[], String[]) allows unordered double array.
     * This is not a bug, added javadoc to emphasize the use of limit
View Full Code Here

Examples of java.text.DecimalFormat.format()

    }

    // ratio
    DecimalFormat myFormat = new DecimalFormat("####0.000");
    progressStr.append(", ");
    progressStr.append(myFormat.format((float)(ratio)/1000));
    progressStr.append(" kB/s");

   
    // time left
    if (this.httpToolDocSize > 0) {
View Full Code Here

Examples of java.text.Format.format()

      return cachedResult;
    }

    try
    {
      cachedResult = f.format(o);
    }
    catch (IllegalArgumentException e)
    {
      cachedResult = getNullValue();
    }
View Full Code Here

Examples of java.text.MessageFormat.format()

public class MessageFormatTest extends TestCase
{
  public static void testMessageFormt()
  {
    MessageFormat format = new MessageFormat("{1} {0,number,integer}"); //$NON-NLS-1$
    System.out.println(format.format(new Object[]{new Integer (1), new Integer (1)}));

    Format[] fmt = format.getFormatsByArgumentIndex();

    for (int i = 0; i < fmt.length; i++)
    {
View Full Code Here

Examples of java.text.NumberFormat.format()

                currencyFormat = DecimalFormat.getCurrencyInstance();
                currencyFormat.setCurrency(Currency.getInstance(currency));
              } else {
                currencyFormat = new DecimalFormat("##0.00");
              }
              value = currencyFormat.format(value);
            } else {
              value = "";
            }
            setHorizontalAlignment(JLabel.RIGHT);
            return super.getTableCellRendererComponent(
View Full Code Here

Examples of java.text.SimpleDateFormat.format()

    public boolean addCreationDate() {
        try {
      /* bugfix by 'taqua' (Thomas) */
      final SimpleDateFormat sdf = new SimpleDateFormat(
          "EEE MMM dd HH:mm:ss zzz yyyy");
      return add(new Meta(Element.CREATIONDATE, sdf.format(new Date())));
    } catch (DocumentException de) {
            throw new ExceptionConverter(de);
        }
    }
   
View Full Code Here

Examples of java.time.LocalDateTime.format()

        DateTimeFormatter formatter =
                DateTimeFormatter
                        .ofPattern("MMM dd, yyyy - HH:mm");

        LocalDateTime parsed = LocalDateTime.parse("Nov 03, 2014 - 07:13", formatter);
        String string = parsed.format(formatter);
        System.out.println(string);     // Nov 03, 2014 - 07:13
    }

}
View Full Code Here

Examples of java.time.OffsetDateTime.format()

  public String format(final LogRecord record) {
    OffsetDateTime date = fromMillis(record.getMillis());
    StringBuilder sb = new StringBuilder();
    // Minimize memory allocations here.
    sb.append("[").append(Thread.currentThread().getName()).append("] ");
    sb.append(date.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)).append(" ");
    sb.append(record.getLevel()).append(" [");
    sb.append(record.getLoggerName()).append("]").append("  ");
    sb.append(record.getMessage());

    sb.append(VertxLoggerFormatter.LINE_SEPARATOR);
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.