scala
object Console

[source: `scala/Console.scala`]

`` `object` Console
  `extends` AnyRef

  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

Value Summary
`final val` | BLACK : String = "\033[30m"
`final val` | BLACK_B : String = "\033[40m"
`final val` | BLINK : String = "\033[5m"
`final val` | BLUE : String = "\033[34m"
`final val` | BLUE_B : String = "\033[44m"
`final val` | BOLD : String = "\033[1m"
`final val` | CYAN : String = "\033[36m"
`final val` | CYAN_B : String = "\033[46m"
`final val` | GREEN : String = "\033[32m"
`final val` | GREEN_B : String = "\033[42m"
`final val` | INVISIBLE : String = "\033[8m"
`final val` | MAGENTA : String = "\033[35m"
`final val` | MAGENTA_B : String = "\033[45m"
`final val` | RED : String = "\033[31m"
`final val` | RED_B : String = "\033[41m"
`final val` | RESET : String = "\033[0m"
`final val` | REVERSED : String = "\033[7m"
`final val` | UNDERLINED : String = "\033[4m"
`final val` | WHITE : String = "\033[37m"
`final val` | WHITE_B : String = "\033[47m"
`final val` | YELLOW : String = "\033[33m"
`final val` | YELLOW_B : String = "\033[43m"
`val` | err : PrintStream

Method Summary
`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.
`def` | format (text : String, args : Any*) : Unit
`def` | in : BufferedReader
`def` | out : PrintStream
`def` | print (obj : Any) : Unit Print an object on the terminal.
`def` | printf (text : String, args : Any*) : Unit Format and print out some text (in a fashion similar to printf in C or `printf` in Java 6). 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.
`def` | println (x : Any) : Unit Print out an object followed by a new line character.
`def` | println : Unit Print a new line character on the terminal.
`def` | readBoolean : Boolean Read a boolean value from the terminal.
`def` | readByte : Byte Read a byte value from the terminal.
`def` | readChar : Char Read a char value from the terminal.
`def` | readDouble : Double Read a double value from the terminal.
`def` | readFloat : Float Read a float value from the terminal.
`def` | readInt : Int Read an int value from the terminal.
`def` | readLine : String Read a full line from the terminal.
`def` | readLine (text : String, args : Any*) : String Print a formatted text and read a full line from the terminal
`def` | readLong : Long Read an int value from the terminal.
`def` | readShort : Short Read a short value from the terminal.
`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.
`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.
`def` | readf2 (format : String) : (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.
`def` | readf3 (format : String) : (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.
`def` | setIn (reader : Reader) : Unit Set the default input stream.
`def` | setIn (in : InputStream) : Unit Set the default input stream.
`def` | setOut (out : PrintStream) : Unit Set the default output stream.
`def` | setOut (out : OutputStream) : Unit Set the default output stream. @param@ out the new output stream.
`def` | withIn [T](in : InputStream)(thunk : => T) : T Set the default input stream for the duration of execution of one thunk.
`def` | withIn [T](reader : Reader)(thunk : => T) : T Set the default input stream for the duration of execution of one thunk.
`def` | withOut [T](out : PrintStream)(thunk : => T) : T Set the default output stream for the duration of execution of one thunk.
`def` | withOut [T](out : OutputStream)(thunk : => T) : T Set the default output stream for the duration of execution of one thunk.

Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Value Details

`final` `val` BLACK : String

`final` `val` RED : String

`final` `val` GREEN : String

`final` `val` YELLOW : String

`final` `val` BLUE : String

`final` `val` MAGENTA : String

`final` `val` CYAN : String

`final` `val` WHITE : String

`final` `val` BLACK_B : String

`final` `val` RED_B : String

`final` `val` GREEN_B : String

`final` `val` YELLOW_B : String

`final` `val` BLUE_B : String

`final` `val` MAGENTA_B : String

`final` `val` CYAN_B : String

`final` `val` WHITE_B : String

`final` `val` RESET : String

`final` `val` BOLD : String

`final` `val` UNDERLINED : String

`final` `val` BLINK : String

`final` `val` REVERSED : String

`final` `val` INVISIBLE : String

`` `val` err : PrintStream

Method Details

`` `def` out : PrintStream

`` `def` in : BufferedReader

`` `def` setOut(out : PrintStream) : Unit

  Set the default output stream.

Parameters
  `out -` the new output stream.

`` `def` withOut[T](out : PrintStream)(thunk : => T) : T

  Set the default output stream for the duration of execution of one thunk.

Parameters
  `out -` the new output stream.
  `thunk -` the code to execute with the new output stream active
Returns
  ...

`` `def` setOut(out : OutputStream) : Unit

  Set the default output stream. @param@ out the new output stream.

`` `def` withOut[T](out : OutputStream)(thunk : => T) : T

  Set the default output stream for the duration of execution of one thunk.

Parameters
  `out -` the new output stream.
  `thunk -` the code to execute with the new output stream active
Returns
  ...

`` `def` setIn(reader : Reader) : Unit

  Set the default input stream.

Parameters
  `reader -` specifies the new input stream.

`` `def` withIn[T](reader : Reader)(thunk : => T) : T

  Set the default input stream for the duration of execution of one thunk.

Parameters
  `in -` the new input stream.
  `thunk -` the code to execute with the new input stream active

`` `def` setIn(in : InputStream) : Unit

  Set the default input stream.

Parameters
  `in -` the new input stream.

`` `def` withIn[T](in : InputStream)(thunk : => T) : T

  Set the default input stream for the duration of execution of one thunk.

Parameters
  `in -` the new input stream.
  `thunk -` the code to execute with the new input stream active

`` `def` print(obj : Any) : Unit

  Print an object on the terminal.

Parameters
  `obj -` the object to print.

`` `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.

`` `def` println : Unit

  Print a new line character on the terminal.

`` `def` println(x : Any) : Unit

  Print out an object followed by a new line character.

Parameters
  `x -` the object to print.

`` `def` printf(text : String, args : Any*) : Unit

  Format and print out some text (in a fashion similar to printf in C or `printf` in Java 6).

  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.
Throws
  `java.lang.IllegalArgumentException -`

`` `def` format(text : String, args : Any*) : Unit

See Also
  Console.printf.

`` `def` readLine : String

  Read a full line from the terminal.

Returns
  the string read from the terminal.

`` `def` readLine(text : String, args : Any*) : String

  Print a formatted text and read a full line from the terminal

Parameters
  `text -` the format of the text to print out.
  `args -` the parameters used to instantiate the format.
Returns
  the string read from the terminal.

`` `def` readBoolean : Boolean

  Read a boolean value from the terminal.

Returns
  the boolean value read from the terminal.

`` `def` readByte : Byte

  Read a byte value from the terminal.

`` `def` readShort : Short

  Read a short value from the terminal.

`` `def` readChar : Char

  Read a char value from the terminal.

`` `def` readInt : Int

  Read an int value from the terminal.

`` `def` readLong : Long

  Read an int value from the terminal.

`` `def` readFloat : Float

  Read a float value from the terminal.

`` `def` readDouble : Double

  Read a double value from the terminal.

`` `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.

`` `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.

Parameters
  `format -` ...
Returns
  ...

`` `def` readf2(format : String) : (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.

Parameters
  `format -` ...
Returns
  ...

`` `def` readf3(format : String) : (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.

Parameters
  `format -` ...
Returns
  ...