List of usage examples for java.util Formatter Formatter
public Formatter(OutputStream os, Charset charset, Locale l)
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();// www .j av a2s . c om 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", 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();/*from w ww . jav a 2 s.c om*/ 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", 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();/*from w ww .j a v a 2s .co m*/ System.out.println("Formatter Flushed."); }