scala

Console

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.

Inherits

  1. AnyRef
  2. Any

Value Members

  1. val BLACK: String

  2. val BLACK_B: String

  3. val BLINK: String

  4. val BLUE: String

  5. val BLUE_B: String

  6. val BOLD: String

  7. val CYAN: String

  8. val CYAN_B: String

  9. val GREEN: String

  10. val GREEN_B: String

  11. val INVISIBLE: String

  12. val MAGENTA: String

  13. val MAGENTA_B: String

  14. val RED: String

  15. val RED_B: String

  16. val RESET: String

  17. val REVERSED: String

  18. val UNDERLINED: String

  19. val WHITE: String

  20. val WHITE_B: String

  21. val YELLOW: String

  22. val YELLOW_B: String

  23. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef ⇐ Any
  24. def err: PrintStream

  25. def flush(): Unit

    Flush the output stream

    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.

  26. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: AnyRef ⇐ Any
  27. def in: BufferedReader

  28. def out: PrintStream

  29. def print(obj: Any): Unit

    Print an object on the terminal

    Print an object on the terminal.

    obj

    the object to print.

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

    Prints its arguments as a formatted string, based on a string pattern (in a fashion similar to printf in C)

    Prints its arguments as a formatted string, based on a string pattern (in a fashion similar to printf in C).

    The interpretation of the formatting patterns is described in java.util.Formatter.

    text

    the pattern for formatting the arguments.

    args

    the arguments used to instantiating the pattern.

  31. def println(x: Any): Unit

    Print out an object followed by a new line character

    Print out an object followed by a new line character.

    x

    the object to print.

  32. def println(): Unit

    Print a new line character on the terminal

    Print a new line character on the terminal.

  33. def readBoolean(): Boolean

    Read a boolean value from the terminal

    Read a boolean value from the terminal. Throws EOFException if the end of the input stream has been reached.

  34. def readByte(): Byte

    Read a byte value from the terminal

    Read a byte value from the terminal. Throws EOFException if the end of the input stream has been reached.

  35. def readChar(): Char

    Read a char value from the terminal

    Read a char value from the terminal. Throws EOFException if the end of the input stream has been reached.

  36. def readDouble(): Double

    Read a double value from the terminal

    Read a double value from the terminal. Throws EOFException if the end of the input stream has been reached.

  37. def readFloat(): Float

    Read a float value from the terminal

    Read a float value from the terminal. Throws EOFException if the end of the input stream has been reached.

  38. def readInt(): Int

    Read an int value from the terminal

    Read an int value from the terminal. Throws EOFException if the end of the input stream has been reached.

  39. def readLine(text: String, args: Any*): String

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

    Print a formatted text and read a full line from the terminal. Returns null if the end of the input stream has been reached.

    text

    the format of the text to print out.

    args

    the parameters used to instantiate the format.

    returns

    the string read from the terminal.

  40. def readLine(): String

    Read a full line from the terminal

    Read a full line from the terminal. Returns null if the end of the input stream has been reached.

  41. def readLong(): Long

    Read an int value from the terminal

    Read an int value from the terminal. Throws EOFException if the end of the input stream has been reached.

  42. def readShort(): Short

    Read a short value from the terminal

    Read a short value from the terminal. Throws EOFException if the end of the input stream has been reached.

  43. def readf(format: String): List[Any]

    Read in some structured input, specified by a format specifier

    Read in some structured input, specified by a format specifier. See class java.text.MessageFormat for details of the format specification. Throws EOFException if the end of the input stream has been reached.

    format

    the format of the input.

    returns

    a list of all extracted values.

  44. def readf1(format: String): Any

    Read in some structured input, specified by a format specifier

    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.

    format

    ...

    returns

    ...

  45. def readf2(format: String): (Any, Any)

    Read in some structured input, specified by a format specifier

    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.

    format

    ...

    returns

    ...

  46. def readf3(format: String): (Any, Any, Any)

    Read in some structured input, specified by a format specifier

    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.

    format

    ...

    returns

    ...

  47. def setErr(err: OutputStream): Unit

    Set the default error stream

    Set the default error stream.

    err

    the new error stream.

  48. def setErr(err: PrintStream): Unit

    Set the default error stream

    Set the default error stream.

    err

    the new error stream.

  49. def setIn(in: InputStream): Unit

    Set the default input stream

    Set the default input stream.

    in

    the new input stream.

  50. def setIn(reader: Reader): Unit

    Set the default input stream

    Set the default input stream.

    reader

    specifies the new input stream.

  51. def setOut(out: OutputStream): Unit

    Set the default output stream

    Set the default output stream.

  52. def setOut(out: PrintStream): Unit

    Set the default output stream

    Set the default output stream.

    out

    the new output stream.

  53. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

    definition classes: AnyRef ⇐ Any
  54. def withErr[T](err: OutputStream)(thunk: ⇒ T): T

    Set the default error stream for the duration of execution of one thunk

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

    err

    the new error stream.

    thunk

    the code to execute with the new error stream active

    returns

    ...

  55. def withErr[T](err: PrintStream)(thunk: ⇒ T): T

    Set the default error stream for the duration of execution of one thunk

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

    err

    the new error stream.

    thunk

    the code to execute with the new error stream active

    returns

    ...

  56. def withIn[T](in: InputStream)(thunk: ⇒ T): T

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

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

    in

    the new input stream.

    thunk

    the code to execute with the new input stream active

  57. def withIn[T](reader: Reader)(thunk: ⇒ T): T

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

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

    thunk

    the code to execute with the new input stream active

  58. def withOut[T](out: OutputStream)(thunk: ⇒ T): T

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

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

    out

    the new output stream.

    thunk

    the code to execute with the new output stream active

    returns

    ...

  59. def withOut[T](out: PrintStream)(thunk: ⇒ T): T

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

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

    out

    the new output stream.

    thunk

    the code to execute with the new output stream active

    returns

    ...