summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ConsoleWriter.scala
blob: 2faf9aecbfac7eeee4d7ebab7d67247a723a5120 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package scala.tools.nsc
import java.io.Writer

/** A Writer that writes onto the Scala Console */
class ConsoleWriter extends Writer {
  def close = flush

  def flush = Console.flush

  def write(cbuf: Array[char], off: int, len: int): Unit =
    if(len > 0)
      write(new String(cbuf.subArray(off, off+len-1)))

  override def write(str: String): Unit = Console.print(str)
}