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) {
    byte c = 70;//from   w w  w  .  j  a va2  s . c  o  m

    PrintStream ps = new PrintStream(System.out);

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

    // flush the stream
    ps.flush();

}

From source file:Main.java

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

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

    // 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);

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

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) {
    byte c = 70;//from  w w  w  . java 2 s.  c o  m

    PrintStream ps = new PrintStream(System.out, true);

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

    // 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);

    // print our string
    ps.print(s);/*from   www .  j a v  a2 s.  c  o  m*/

    // flush the stream to see the results
    ps.flush();

    // print new string
    ps.println();
    ps.print("This is an example");

    // flush to see new string
    ps.flush();

}

From source file:Main.java

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

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

    // flush the stream
    ps.flush();

}

From source file:Main.java

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

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

    // 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);

    // print string
    ps.print(s);//  w  w w.ja v  a  2  s.  co  m
    ps.print(" This is an example");

    // flush the stream
    ps.flush();

}

From source file:Main.java

public static void main(String[] args) throws UnsupportedEncodingException {
    byte c = 70;/*from  w  w w. j  a  v  a 2s  .c om*/

    PrintStream ps = new PrintStream(System.out, true, "UTF8");

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

    // 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);

    // format a string
    ps.format(Locale.UK, "This is a %s program", s);

    // flush to see the string
    ps.flush();

}