Example usage for java.io PrintStream flush

List of usage examples for java.io PrintStream flush

Introduction

In this page you can find the example usage for java.io PrintStream flush.

Prototype

public void flush() 

Source Link

Document

Flushes the stream.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    byte c = 70;//from w ww  .j  a  va2  s . c o  m
    PrintStream ps = new PrintStream(new File("c:/text.txt"), "ASCII");

    // write byte c which is character F in ASCII
    ps.write(c);

    // flush the stream
    ps.flush();
    ps.close();
}

From source file:Main.java

public static void main(String[] args) {
    String s = "from java2s.com";

    PrintStream ps = new PrintStream(System.out);

    // printf this string
    ps.printf(Locale.CANADA, "This is a %s application", s);

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) {
    String s = "from java2s.com. ";

    PrintStream ps = new PrintStream(System.out);

    // append our strings
    ps.append(s);//from  ww  w . j  a  v  a 2 s . c om
    ps.append("This is an example.");

    // print the result
    ps.flush();
    ps.close();

}

From source file:Main.java

public static void main(String[] args) {
    String s = "from java2s.com.";

    // create a new PrintStream
    PrintStream ps = new PrintStream(System.out);

    // print a string
    ps.println(s);//w ww  .  j  a  va2 s .  c o  m

    // check for errors and print
    ps.print(ps.checkError());
    ps.flush();
    ps.close();

}

From source file:Main.java

public static void main(String[] args) {
    float c = 1.234567f;

    PrintStream ps = new PrintStream(System.out);

    // print a float and change line
    ps.println(c);/*from   w  w w  .  j a v  a 2  s .c  o m*/
    ps.print("from java2s.com");

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) {
    String c = "from java2s.com";

    PrintStream ps = new PrintStream(System.out);

    // print a string and change line
    ps.println(c);/*from w  w w .j a  va2s .c  o m*/
    ps.print("from java2s.com");

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) {
    double c = 12345.56;

    PrintStream ps = new PrintStream(System.out);

    // print a double and change line
    ps.println(c);// w  ww. java  2s. c om
    ps.print("from java2s.com");

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) {
    char[] c = { 'a', 'b', 'c' };

    PrintStream ps = new PrintStream(System.out);

    // print an array and change line
    ps.println(c);//from  w  ww  .ja  v  a  2  s.c o m
    ps.print("from java2s.com");

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) {
    Object c = 15;//from  www.ja  va 2s. com

    PrintStream ps = new PrintStream(System.out);

    // print an object and change line
    ps.println(c);
    ps.print("from java2s.com");

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) {

    PrintStream ps = new PrintStream(System.out);

    // print a boolean and change line
    ps.println(true);/*  w ww.  j  av a  2  s .  c o  m*/
    ps.print("from java2s.com");

    // flush the stream
    ps.flush();

}