Package java.util

Examples of java.util.Formatter.format()


    }
    pathFormat = pathFormat.replace('/', File.separatorChar);
    StringBuilder strBuffer = new StringBuilder();

    Formatter formatter = new Formatter(strBuffer, Locale.US);
    formatter.format(pathFormat, date);
    formatter.close();

    if (!pathFormat.endsWith(File.separator)) {
      strBuffer.append(File.separator);
    }
View Full Code Here


        PrintWriter out = INSTANCE.out;
        synchronized(out) {
            StackTraceElement el = getLine();
            Formatter formatter = new Formatter();
            try {
                String location = formatter.format("(%s:%d)", el.getFileName(), el.getLineNumber()).toString();
                out.printf("vlcj: %-46s | %-5s | %s%n", location, level, format(msg, args));
                out.flush();
                if(t != null) {
                    PrintWriter err = INSTANCE.err;
                    err.printf("vlcj: %-46s | %-5s | %s%n", location, level, t.getMessage());
View Full Code Here

                {
                    found = true;
                    name = name.substring(3);
                    m.setAccessible(true);
                    Object value = m.invoke(b, (Object[]) null);
                    f.format(COLUMN, name, format(value, Converter.LINE, this));
                }
            }
            catch (IllegalAccessException e)
            {
                // Ignore
View Full Code Here

        // there should be 100 of each
        String[] scientists = {"Einstein", "Darwin", "Copernicus", "Pasteur", "Curie", "Faraday", "Newton", "Bohr", "Galilei", "Maxwell"};
        for (int i = 1; i <= 1000; i++) {
            int index = i % scientists.length;
            Formatter f = new Formatter();
            String doc = f.format("{\"_id\":\"%d\", \"scientist\":\"%s\", \"fixedField\": \"fixedValue\"}", i, scientists[index]).toString();
            IOHelper.close(f);
            testCollection.insert((DBObject) JSON.parse(doc), WriteConcern.SAFE);
        }
        assertEquals("Data pumping of 1000 entries did not complete entirely", 1000L, testCollection.count());
    }
View Full Code Here

        assertEquals(0, testCollection.count());
        for (int i = 1; i <= 100; i++) {
            String body = null;
            Formatter f = new Formatter();
            if (i % 2 == 0) {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
            } else {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\", \"extraField\": true}", i).toString();
            }
            f.close();
            template.requestBody("direct:insert", body);
View Full Code Here

            String body = null;
            Formatter f = new Formatter();
            if (i % 2 == 0) {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
            } else {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\", \"extraField\": true}", i).toString();
            }
            f.close();
            template.requestBody("direct:insert", body);
        }
        assertEquals(100L, testCollection.count());
View Full Code Here

        assertEquals(0, testCollection.count());
        for (int i = 1; i <= 100; i++) {
            String body = null;
            Formatter f = new Formatter();
            if (i % 2 == 0) {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
            } else {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\", \"extraField\": true}", i).toString();
            }
            f.close();
            template.requestBody("direct:insert", body);
View Full Code Here

            String body = null;
            Formatter f = new Formatter();
            if (i % 2 == 0) {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
            } else {
                body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\", \"extraField\": true}", i).toString();
            }
            f.close();
            template.requestBody("direct:insert", body);
        }
        assertEquals(100L, testCollection.count());
View Full Code Here

       
        // Add some records to the collection (and do it via camel-mongodb)
        for (int i = 1; i <= 100; i++) {
            String body = null;
            Formatter f = new Formatter();
            body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
            f.close();
            template.requestBody("direct:insert", body);
        }
       
        Object result = template.requestBody("direct:getColStats", "irrelevantBody");
View Full Code Here

  /**
   * @return
   */
  public EString to_list() {
    Formatter form = new Formatter();
    form = form.format("%.20e", value);
    String value = form.toString();
    return new EString(value);
  }

  public String format(EObject options) {
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.