diff options
Diffstat (limited to 'src/main/scala/spark/repl/SparkSimpleReader.scala')
-rw-r--r-- | src/main/scala/spark/repl/SparkSimpleReader.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main/scala/spark/repl/SparkSimpleReader.scala b/src/main/scala/spark/repl/SparkSimpleReader.scala new file mode 100644 index 0000000000..2b24c4bf63 --- /dev/null +++ b/src/main/scala/spark/repl/SparkSimpleReader.scala @@ -0,0 +1,33 @@ +/* NSC -- new Scala compiler + * Copyright 2005-2010 LAMP/EPFL + * @author Stepan Koltsov + */ + +package spark.repl + +import scala.tools.nsc +import scala.tools.nsc._ +import scala.tools.nsc.interpreter +import scala.tools.nsc.interpreter._ + +import java.io.{ BufferedReader, PrintWriter } +import io.{ Path, File, Directory } + +/** Reads using standard JDK API */ +class SparkSimpleReader( + in: BufferedReader, + out: PrintWriter, + val interactive: Boolean) +extends SparkInteractiveReader { + def this() = this(Console.in, new PrintWriter(Console.out), true) + def this(in: File, out: PrintWriter, interactive: Boolean) = this(in.bufferedReader(), out, interactive) + + def close() = in.close() + def readOneLine(prompt: String): String = { + if (interactive) { + out.print(prompt) + out.flush() + } + in.readLine() + } +} |