scala.io

Source

class Source extends Iterator[Char]

The class Source implements an iterable representation of source data. Calling method reset returns an identical, resetted source, where possible.

attributes: abstract
go to: companion
known subclasses: BufferedSource
source: Source.scala
    version
  1. 1.0

    authors:
  1. Burak Emir

Inherited
  1. Hide All
  2. Show all
  1. Iterator
  2. TraversableOnce
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Instance constructors

  1. new Source()

Type Members

  1. class GroupedIterator[B >: A] extends Iterator[Seq[B]]

    A flexible iterator for transforming an Iterator[A] into an Iterator[Seq[A]], with configurable sequence size, step, and strategy for dealing with elements which don't fit evenly.

  2. class LineIterator extends Iterator[String]

  3. class Positioner extends AnyRef

Value Members

  1. def !=(arg0: AnyRef): Boolean

  2. def !=(arg0: Any): Boolean

    o != arg0 is the same as !(o == (arg0)).

  3. def ##(): Int

  4. def $asInstanceOf[T0](): T0

  5. def $isInstanceOf[T0](): Boolean

  6. def ++(that: ⇒ Iterator[Char]): Iterator[Char]

    [use case] Concatenates this iterator with another.

  7. def ++[B >: Char](that: ⇒ Iterator[B]): Iterator[B]

    Concatenates this iterator with another.

  8. def /:[B](z: B)(op: (B, Char) ⇒ B): B

    Applies a binary operator to a start value and all elements of this traversable or iterator, going left to right.

  9. def :\[B](z: B)(op: (Char, B) ⇒ B): B

    Applies a binary operator to all elements of this traversable or iterator and a start value, going right to left.

  10. def ==(arg0: AnyRef): Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

  11. def ==(arg0: Any): Boolean

    o == arg0 is the same as o.equals(arg0).

  12. object NoPositioner extends Positioner

  13. def addString(b: StringBuilder): StringBuilder

    Appends all elements of this traversable or iterator to a string builder.

  14. def addString(b: StringBuilder, sep: String): StringBuilder

    Appends all elements of this traversable or iterator to a string builder using a separator string.

  15. def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

    Appends all elements of this traversable or iterator to a string builder using start, end, and separator strings.

  16. def append[B >: Char](that: Iterator[B]): Iterator[B]

    Returns a new iterator that first yields the elements of this iterator followed by the elements provided by iterator that.

  17. def asInstanceOf[T0]: T0

    This method is used to cast the receiver object to be of type T0.

  18. def buffered: BufferedIterator[Char]

    Creates a buffered iterator from this iterator.

  19. def ch: Char

  20. def clone(): AnyRef

    This method creates and returns a copy of the receiver object.

  21. def close(): Unit

    The close() method closes the underlying resource.

  22. def collect[B](pf: PartialFunction[Char, B]): Iterator[B]

    Creates an iterator by transforming values produced by this iterator with a partial function, dropping those values for which the partial function is not defined.

  23. def contains(elem: Any): Boolean

    Tests whether this iterator contains a given value as an element.

  24. def copyToArray(xs: Array[Char], start: Int, len: Int): Unit

    [use case] Copies selected values produced by this iterator to an array.

  25. def copyToArray[B >: Char](xs: Array[B], start: Int, len: Int): Unit

    Copies selected values produced by this iterator to an array.

  26. def copyToArray(xs: Array[Char]): Unit

    [use case] Copies values of this traversable or iterator to an array.

  27. def copyToArray[B >: Char](xs: Array[B]): Unit

    Copies values of this traversable or iterator to an array.

  28. def copyToArray(xs: Array[Char], start: Int): Unit

    [use case] Copies values of this traversable or iterator to an array.

  29. def copyToArray[B >: Char](xs: Array[B], start: Int): Unit

    Copies values of this traversable or iterator to an array.

  30. def copyToBuffer[B >: Char](dest: Buffer[B]): Unit

    Copies all elements of this traversable or iterator to a buffer.

  31. def count(p: (Char) ⇒ Boolean): Int

    Counts the number of elements in the traversable or iterator which satisfy a predicate.

  32. def counted: CountedIterator[Char]

    Returns a counted iterator from this iterator.

  33. var descr: String

    description of this source, default empty

  34. def drop(n: Int): Iterator[Char]

    Advances this iterator past the first n elements, or the length of the iterator, whichever is smaller.

  35. def dropWhile(p: (Char) ⇒ Boolean): Iterator[Char]

    Skips longest sequence of elements of this iterator which satisfy given predicate p, and returns an iterator of the remaining elements.

  36. def duplicate: (Iterator[Char], Iterator[Char])

    Creates two new iterators that both iterate over the same elements as this iterator (in the same order).

  37. def eq(arg0: AnyRef): Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

  38. def equals(arg0: Any): Boolean

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

  39. def exists(p: (Char) ⇒ Boolean): Boolean

    Tests whether a predicate holds for some of the values produced by this iterator.

  40. def filter(p: (Char) ⇒ Boolean): Iterator[Char]

    Returns an iterator over all the elements of this iterator that satisfy the predicate p.

  41. def filterNot(p: (Char) ⇒ Boolean): Iterator[Char]

    Creates an iterator over all the elements of this iterator which do not satisfy a predicate p.

  42. def finalize(): Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

  43. def find(p: (Char) ⇒ Boolean): Option[Char]

    Finds the first value produced by the iterator satisfying a predicate, if any.

  44. def findIndexOf(p: (Char) ⇒ Boolean): Int

    Returns index of the first element satisfying a predicate, or -1.

  45. def flatMap[B](f: (Char) ⇒ Iterator[B]): Iterator[B]

    Creates a new iterator by applying a function to all values produced by this iterator and concatenating the results.

  46. def foldLeft[B](z: B)(op: (B, Char) ⇒ B): B

    Applies a binary operator to a start value and all elements of this traversable or iterator, going left to right.

  47. def foldRight[B](z: B)(op: (Char, B) ⇒ B): B

    Applies a binary operator to all elements of this traversable or iterator and a start value, going right to left.

  48. def forall(p: (Char) ⇒ Boolean): Boolean

    Tests whether a predicate holds for all values produced by this iterator.

  49. def foreach(f: (Char) ⇒ Unit): Unit

    [use case] Applies a function f to all values produced by this iterator.

  50. def foreach[U](f: (Char) ⇒ U): Unit

    Applies a function f to all values produced by this iterator.

  51. def getClass(): java.lang.Class[_ <: java.lang.Object]

    Returns a representation that corresponds to the dynamic class of the receiver object.

  52. def getLine(line: Int): String

    convenience method, returns given line (not including newline) from Source.

  53. def getLines(separator: String = scala.compat.Platform.EOL): Iterator[String]

    returns an iterator who returns lines (NOT including newline character(s)).

  54. def grouped[B >: Char](size: Int): GroupedIterator[B]

    Returns an iterator which groups this iterator into fixed size blocks.

  55. def hasDefiniteSize: Boolean

    Tests whether this Iterator has a known size.

  56. def hasNext: Boolean

    Returns true if this source has more characters.

  57. def hashCode(): Int

    Returns a hash code value for the object.

  58. def indexOf[B >: Char](elem: B): Int

    Returns the index of the first occurrence of the specified object in this iterable object.

  59. def indexWhere(p: (Char) ⇒ Boolean): Int

    Returns the index of the first produced value satisfying a predicate, or -1.

  60. def isEmpty: Boolean

    Tests whether this iterator is empty.

  61. def isInstanceOf[T0]: Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

  62. def isTraversableAgain: Boolean

    Tests whether this Iterator can be repeatedly traversed.

  63. val iter: Iterator[Char]

    the actual iterator

  64. def length: Int

    Returns the number of elements in this iterator.

  65. def map[B](f: (Char) ⇒ B): Iterator[B]

    Creates a new iterator that maps all produced values of this iterator to new values using a transformation function.

  66. def max: Char

    [use case] Finds the largest element.

  67. def max[B >: Char](implicit cmp: Ordering[B]): Char

    Finds the largest element.

  68. def min: Char

    [use case] Finds the smallest element.

  69. def min[B >: Char](implicit cmp: Ordering[B]): Char

    Finds the smallest element.

  70. def mkString: String

    Displays all elements of this traversable or iterator in a string.

  71. def mkString(sep: String): String

    Displays all elements of this traversable or iterator in a string using a separator string.

  72. def mkString(start: String, sep: String, end: String): String

    Displays all elements of this traversable or iterator in a string using start, end, and separator strings.

  73. def ne(arg0: AnyRef): Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

  74. var nerrors: Int

  75. def next(): Char

    Returns next character.

  76. def nonEmpty: Boolean

    Tests whether the traversable or iterator is not empty.

  77. def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

  78. def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

  79. var nwarnings: Int

  80. def padTo(len: Int, elem: Char): Iterator[Char]

    [use case] Appends an element value to this iterator until a given target length is reached.

  81. def padTo[A1 >: Char](len: Int, elem: A1): Iterator[A1]

    Appends an element value to this iterator until a given target length is reached.

  82. def partition(p: (Char) ⇒ Boolean): (Iterator[Char], Iterator[Char])

    Partitions this iterator in two iterators according to a predicate.

  83. def patch[B >: Char](from: Int, patchElems: Iterator[B], replaced: Int): Iterator[B]

    Returns this iterator with patched values.

  84. def pos: Int

  85. def product: Int

    [use case] Multiplies up the elements of this collection.

  86. def product[B >: Char](implicit num: Numeric[B]): B

    Multiplies up the elements of this collection.

  87. def readInto[B >: Char](xs: Array[B]): Unit

  88. def readInto[B >: Char](xs: Array[B], start: Int): Unit

  89. def readInto[B >: Char](xs: Array[B], start: Int, sz: Int): Unit

    Fills the given array xs with the elements of this sequence starting at position start.

  90. def reduceLeft[B >: Char](op: (B, Char) ⇒ B): B

    Applies a binary operator to all elements of this traversable or iterator, going left to right.

  91. def reduceLeftOption[B >: Char](op: (B, Char) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this traversable or iterator, going left to right.

  92. def reduceRight[B >: Char](op: (Char, B) ⇒ B): B

    Applies a binary operator to all elements of this traversable or iterator, going right to left.

  93. def reduceRightOption[B >: Char](op: (Char, B) ⇒ B): Option[B]

    Optionally applies a binary operator to all elements of this traversable or iterator, going right to left.

  94. def report(pos: Int, msg: String, out: PrintStream): Unit

    no summary matey

  95. def reportError(pos: Int, msg: String, out: PrintStream = scala.Console.err): Unit

    Reports an error message to the output stream out.

  96. def reportWarning(pos: Int, msg: String, out: PrintStream = scala.Console.out): Unit

    no summary matey

  97. def reset(): Source

    The reset() method creates a fresh copy of this Source.

  98. def reversed: List[Char]

  99. def sameElements(that: Iterator[_]): Boolean

    Tests if another iterator produces the same values as this one.

  100. def size: Int

    The size of this traversable or iterator.

  101. def slice(from: Int, until: Int): Iterator[Char]

    Creates an iterator returning an interval of the values produced by this iterator.

  102. def sliding[B >: Char](size: Int, step: Int = 1): GroupedIterator[B]

    Returns an iterator which presents a "sliding window" view of another iterator.

  103. def sum: Int

    [use case] Sums up the elements of this collection.

  104. def sum[B >: Char](implicit num: Numeric[B]): B

    Sums up the elements of this collection.

  105. def synchronized[T0](arg0: T0): T0

  106. def take(n: Int): Iterator[Char]

    Selects first n values of this iterator.

  107. def takeWhile(p: (Char) ⇒ Boolean): Iterator[Char]

    Takes longest prefix of values produced by this iterator that satisfy a predicate.

  108. def toArray: Array[Char]

    [use case] Converts this traversable or iterator to an array.

  109. def toArray[B >: Char](implicit arg0: ClassManifest[B]): Array[B]

    Converts this traversable or iterator to an array.

  110. def toBuffer[B >: Char]: Buffer[B]

    Converts this traversable or iterator to a mutable buffer.

  111. def toIndexedSeq[B >: Char]: IndexedSeq[B]

    Converts this traversable or iterator to an indexed sequence.

  112. def toIterable: Iterable[Char]

    Converts this traversable or iterator to an iterable collection.

  113. def toIterator: Iterator[Char]

    Returns an Iterator over the elements in this traversable or iterator.

  114. def toList: List[Char]

    Converts this traversable or iterator to a list.

  115. def toMap[T, U](implicit ev: <:<[Char, (T, U)]): Map[T, U]

    Converts this traversable or iterator to a map.

  116. def toSeq: Seq[Char]

    Converts this traversable or iterator to a sequence.

  117. def toSet[B >: Char]: Set[B]

    Converts this traversable or iterator to a set.

  118. def toStream: Stream[Char]

    Converts this traversable or iterator to a stream.

  119. def toString(): String

    Converts this iterator to a string.

  120. def toTraversable: Traversable[Char]

    Converts this traversable or iterator to an unspecified Traversable.

  121. def wait(): Unit

  122. def wait(arg0: Long, arg1: Int): Unit

  123. def wait(arg0: Long): Unit

  124. def withClose(f: () ⇒ Unit): Source

  125. def withDescription(text: String): Source

  126. def withFilter(p: (Char) ⇒ Boolean): Iterator[Char]

    Creates an iterator over all the elements of this iterator that satisfy the predicate p.

  127. def withPositioning(on: Boolean): Source

  128. def withReset(f: () ⇒ Source): Source

  129. def zip[B](that: Iterator[B]): Iterator[(Char, B)]

    Creates an iterator formed from this iterator and another iterator by combining corresponding values in pairs.

  130. def zipAll[B](that: Iterator[B], thisElem: Char, thatElem: B): Iterator[(Char, B)]

    [use case] Creates an iterator formed from this iterator and another iterator by combining corresponding elements in pairs.

  131. def zipAll[B, A1 >: Char, B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1): Iterator[(A1, B1)]

    Creates an iterator formed from this iterator and another iterator by combining corresponding elements in pairs.

  132. def zipWithIndex: Iterator[(Char, Int)] {...}

    Creates an iterator that pairs each element produced by this iterator with its index, counting from 0.