gr.aueb.dds
Class BIO

java.lang.Object
  |
  +--gr.aueb.dds.BIO

public class BIO
extends Object

A class containing static methods that allow the simple, correct, and efficient procesing of a console application's standard input and output streams. Output is buffered, but automagically flushed, so that prompts in interactive applications work as expected. All errors will terminate the application with an error message. The code was written to provide an easy-to-learn and consistent interface for learning Java. It is not intended for production work.

Version:
$Revision: 1.4 $
See Also:
java.io, Writer, PrintWriter

Constructor Summary
BIO()
           
 
Method Summary
static void flush()
          Flush the output stream.
static void print(boolean x)
          Print the argument of type boolean on the standard output.
static void print(char x)
          Print the argument of type char on the standard output.
static void print(double x)
          Print the argument of type double on the standard output.
static void print(int x)
          Print the argument of type int on the standard output.
static void print(Object x)
          Print the argument of type Object on the standard output.
static void println()
          Print a newline onthe standard output
static void println(boolean x)
          Print the argument of type boolean on the standard output, followed by a newline.
static void println(char x)
          Print the argument of type char on the standard output, followed by a newline.
static void println(double x)
          Print the argument of type double on the standard output, followed by a newline.
static void println(int x)
          Print the argument of type char on the standard output, followed by a newline.
static void println(Object x)
          Print the argument of type Object on the standard output, followed by a newline.
static int readChar()
          Read a character from the standard input.
static double readDouble()
          Read a double from the standard input and return its value.
static int readInt()
          Read an integer from the standard input and return its value.
static String readString()
          Read a line from the standard input and return it as a string.
 
Methods inherited from class java.lang.Object
wait
 

Constructor Detail

BIO

public BIO()
Method Detail

flush

public static void flush()
Flush the output stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Flushing is automatically performed before reading input from a source * that could be affected by reading the program's output (e.g. a human).

print

public static void print(boolean x)
Print the argument of type boolean on the standard output.

print

public static void print(char x)
Print the argument of type char on the standard output.

print

public static void print(double x)
Print the argument of type double on the standard output.

print

public static void print(int x)
Print the argument of type int on the standard output.

print

public static void print(Object x)
Print the argument of type Object on the standard output.

println

public static void println()
Print a newline onthe standard output

println

public static void println(boolean x)
Print the argument of type boolean on the standard output, followed by a newline.

println

public static void println(char x)
Print the argument of type char on the standard output, followed by a newline.

println

public static void println(double x)
Print the argument of type double on the standard output, followed by a newline.

println

public static void println(int x)
Print the argument of type char on the standard output, followed by a newline.

println

public static void println(Object x)
Print the argument of type Object on the standard output, followed by a newline.

readChar

public static int readChar()
Read a character from the standard input. Returns the integer value of the caracter or -1 if the end of file is reached. The character code result can be cast into a character by using the (char)code construct. Any buffered output will be flushed if no characters are available for reading on the standard input. When reading from a console terminal, characters are not made available until the user terminate a line with the ENTER key.

readDouble

public static double readDouble()
Read a double from the standard input and return its value. The number must be given on a single newline-terminated line. Any buffered output will be flushed if no characters are available for reading on the standard input. The program will terminate with an error message on invalid input.

readInt

public static int readInt()
Read an integer from the standard input and return its value. The integer must be given on a single newline-terminated line. Any buffered output will be flushed if no characters are available for reading on the standard input. The program will terminate with an error message on invalid input.

readString

public static String readString()
Read a line from the standard input and return it as a string. Any buffered output will be flushed if no characters are available for reading on the standard input.


Contents