Example usage for java.util Formatter flush

List of usage examples for java.util Formatter flush

Introduction

In this page you can find the example usage for java.util Formatter flush.

Prototype

public void flush() 

Source Link

Document

Flushes this formatter.

Usage

From source file:Main.java

public static void main(String[] args) {

    Formatter formatter = new Formatter();

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) {

    StringBuffer buffer = new StringBuffer();
    Formatter formatter = new Formatter(buffer);

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) {

    StringBuffer buffer = new StringBuffer();
    Formatter formatter = new Formatter(buffer, Locale.US);

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {

    Formatter formatter = new Formatter("generated/format.txt");

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {

    Formatter formatter = new Formatter("generated/format.txt", "ASCII");

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException {

    Formatter formatter = new Formatter(new File("generated/format.txt"));

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {

    Formatter formatter = new Formatter(new File("generated/format.txt"), "ASCII");

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException {

    Formatter formatter = new Formatter(new FileOutputStream("generated/format.txt"));

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {

    Formatter formatter = new Formatter("generated/format.txt", "ASCII", Locale.getDefault());

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {

    Formatter formatter = new Formatter(new FileOutputStream("generated/format.txt"), "ASCII");

    // format a new string
    String name = "from java2s.com";
    formatter.format("Hello %s !", name);

    // print the formatted string
    System.out.println(formatter);

    // flush the formatter. Here it does nothing.
    formatter.flush();
    System.out.println("Formatter Flushed.");
}