ReaderMethods

final implicit class ReaderMethods[T <: Reader](reader: T) extends AnyVal

Provides extension methods for java.io.Reader.

See also:

WriterMethods

class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def filterLines(p: String => Boolean): Seq[String]

Filters lines reader reader using supplied predicate.

Filters lines reader reader using supplied predicate.

Value parameters:
p

predicate

def flatMapLines[T](f: String => Iterable[T]): Seq[T]

Builds collection using elements mapped from lines reader reader.

Builds collection using elements mapped from lines reader reader.

Value parameters:
f

function

def foldLines[T](init: T)(op: (T, String) => T): T

Folds lines from reader to single value using given initial value and binary operator.

Folds lines from reader to single value using given initial value and binary operator.

Value parameters:
init

initial value

op

binary operator

Returns:

init if end of stream; otherwise, last value returned from op

def forEachLine(f: String => Unit): Unit

Reads content and invokes supplied function for each line.

Reads content and invokes supplied function for each line.

The line content, excluding line separator, is passed to function.

Value parameters:
f

function

def getLines(): Seq[String]

Gets lines in file.

Gets lines in file.

def getText(): String

Gets remaining text.

Gets remaining text.

def mapLines[T](f: String => T): Seq[T]

Maps each line reader reader using supplied function.

Maps each line reader reader using supplied function.

Value parameters:
f

function