in scala
object Console

object Console
extends Object
with ScalaObject

The Console object implements functionality for printing Scala values on the terminal. There are also functions for reading specific values. Console also defines constants for marking up text on ANSI terminals.
Author:
Matthias Zenger
Version:
1.0, 03/09/2003

Field Summary
final val BLACK: String
final val BLACK_B: String
final val BLINK: String
final val BLUE: String
final val BLUE_B: String
final val BOLD: String
final val CYAN: String
final val CYAN_B: String
final val GREEN: String
final val GREEN_B: String
final val INVISIBLE: String
final val MAGENTA: String
final val MAGENTA_B: String
final val RED: String
final val RED_B: String
final val RESET: String
final val REVERSED: String
final val UNDERLINED: String
final val WHITE: String
final val WHITE_B: String
final val YELLOW: String
final val YELLOW_B: String

Method Summary
final def flush: Unit
     Flush the output stream.
final def print(obj: Any): Unit
     Print an object on the terminal.
final def printf(text: String)(args: Any*): Unit
     Format and print out some text (in a fashion similar to printf in C).
final def println: Unit
     Print a new line character on the terminal.
final def println(x: Any): Unit
     Print out an object followed by a new line character.
final def readBoolean: Boolean
     Read a boolean value from the terminal.
final def readByte: Byte
     Read a byte value from the terminal.
final def readChar: Char
     Read a char value from the terminal.
final def readDouble: Double
     Read a double value from the terminal.
final def readFloat: Float
     Read a float value from the terminal.
final def readInt: Int
     Read an int value from the terminal.
final def readLine: String
     Read a full line from the terminal.
final def readShort: Short
     Read a short value from the terminal.
final def readf(format: String): List[Any]
     Read in some structured input, specified by a format specifier.
final def readf1(format: String): Any
     Read in some structured input, specified by a format specifier.
final def readf2(format: String): Tuple2[Any,Any]
     Read in some structured input, specified by a format specifier.
final def readf3(format: String): Tuple3[Any,Any,Any]
     Read in some structured input, specified by a format specifier.
final def setIn(in: java.io.InputStream): Unit
     Set the default input stream.
final def setIn(reader: java.io.Reader): Unit
     Set the default input stream.
final def setOut(out: java.io.PrintStream): Unit
     Set the default output stream.

Field Detail

BLACK

  final val BLACK: String

RED

  final val RED: String

GREEN

  final val GREEN: String

YELLOW

  final val YELLOW: String

BLUE

  final val BLUE: String

MAGENTA

  final val MAGENTA: String

CYAN

  final val CYAN: String

WHITE

  final val WHITE: String

BLACK_B

  final val BLACK_B: String

RED_B

  final val RED_B: String

GREEN_B

  final val GREEN_B: String

YELLOW_B

  final val YELLOW_B: String

BLUE_B

  final val BLUE_B: String

MAGENTA_B

  final val MAGENTA_B: String

CYAN_B

  final val CYAN_B: String

WHITE_B

  final val WHITE_B: String

RESET

  final val RESET: String

BOLD

  final val BOLD: String

UNDERLINED

  final val UNDERLINED: String

BLINK

  final val BLINK: String

REVERSED

  final val REVERSED: String

INVISIBLE

  final val INVISIBLE: String
Method Detail

setOut

  final def setOut(out: java.io.PrintStream): Unit
Set the default output stream.
Parameters:
out - the new output stream.

setIn

  final def setIn(in: java.io.InputStream): Unit
Set the default input stream.
Parameters:
in - the new input stream.

setIn

  final def setIn(reader: java.io.Reader): Unit
Set the default input stream.
Parameters:
reader - specifies the new input stream.

print

  final def print(obj: Any): Unit
Print an object on the terminal.
Parameters:
obj - the object to print.

flush

  final def flush: Unit
Flush the output stream. This function is required when partial output (i.e. output not terminated by a new line character) has to be made visible on the terminal.

println

  final def println: Unit
Print a new line character on the terminal.

println

  final def println(x: Any): Unit
Print out an object followed by a new line character.
Parameters:
x - the object to print.

printf

  final def printf(text: String)(args: Any*): Unit
Format and print out some text (in a fashion similar to printf in C). The format of the text to print is specified by the parameter text. The arguments that are inserted into specific locations in text are provided with parameter args. See class java.text.MessageFormat for a full specification of the format syntax.
Parameters:
text - the format of the text to print out.
args - the parameters used to instantiate the format.

readLine

  final def readLine: String
Read a full line from the terminal.
Returns:
the string read from the terminal.

readBoolean

  final def readBoolean: Boolean
Read a boolean value from the terminal.
Returns:
the boolean value read from the terminal.

readByte

  final def readByte: Byte
Read a byte value from the terminal.

readShort

  final def readShort: Short
Read a short value from the terminal.

readChar

  final def readChar: Char
Read a char value from the terminal.

readInt

  final def readInt: Int
Read an int value from the terminal.

readFloat

  final def readFloat: Float
Read a float value from the terminal.

readDouble

  final def readDouble: Double
Read a double value from the terminal.

readf

  final def readf(format: String): List[Any]
Read in some structured input, specified by a format specifier. See class java.text.MessageFormat for details of the format specification.
Parameters:
format - the format of the input.
Returns:
a list of all extracted values.

readf1

  final def readf1(format: String): Any
Read in some structured input, specified by a format specifier. Opposed to readf, this function only returns the first value extracted from the input according to the format specification.

readf2

  final def readf2(format: String): Tuple2[Any,Any]
Read in some structured input, specified by a format specifier. Opposed to readf, this function only returns the first two values extracted from the input according to the format specification.

readf3

  final def readf3(format: String): Tuple3[Any,Any,Any]
Read in some structured input, specified by a format specifier. Opposed to readf, this function only returns the first three values extracted from the input according to the format specification.