play.api.libs.iteratee

Enumerator

object Enumerator

Enumerator is the source that pushes input into a given iteratee. It enumerates some input into the iteratee and eventually returns the new state of that iteratee.

Source
Enumerator.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Enumerator
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait Pushee[E] extends AnyRef

  2. trait TreatCont0[E] extends AnyRef

  3. trait TreatCont1[E, S] extends AnyRef

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def apply[E](in: E*): Enumerator[E]

    Create an Enumerator from a set of values

    Create an Enumerator from a set of values

    Example:

    val enumerator: Enumerator[String] = Enumerator("kiki", "foo", "bar")
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def checkContinue0[E](inner: TreatCont0[E]): Enumerator[E]

  9. def checkContinue1[E, S](s: S)(inner: TreatCont1[E, S]): Enumerator[E]

  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. def enumInput[E](e: Input[E]): Enumerator[E]

    Creates an enumerator which produces the one supplied input and nothing else.

    Creates an enumerator which produces the one supplied input and nothing else. This enumerator will NOT automatically produce Input.EOF after the given input.

  12. def enumerate[E](traversable: TraversableOnce[E])(implicit ctx: ExecutionContext): Enumerator[E]

    Create an Enumerator from any TraversableOnce like collection of elements.

    Create an Enumerator from any TraversableOnce like collection of elements.

    Example of an iterator of lines of a file :

    val enumerator: Enumerator[String] = Enumerator( scala.io.Source.fromFile("myfile.txt").getLines )
  13. def eof[A]: Enumerator[A]

    An enumerator that produces EOF and nothing else.

  14. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  17. def flatten[E](eventuallyEnum: Future[Enumerator[E]]): Enumerator[E]

  18. def fromCallback1[E](retriever: (Boolean) ⇒ Future[Option[E]], onComplete: () ⇒ Unit, onError: (String, Input[E]) ⇒ Unit): Enumerator[E]

  19. def fromFile(file: File, chunkSize: Int = 1024 * 8): Enumerator[Array[Byte]]

    Create an enumerator from the given input stream.

    Create an enumerator from the given input stream.

    Note that this enumerator will block when it reads from the file.

    file

    The file to create the enumerator from.

    chunkSize

    The size of chunks to read from the file.

  20. def fromStream(input: InputStream, chunkSize: Int = 1024 * 8): Enumerator[Array[Byte]]

    Create an enumerator from the given input stream.

    Create an enumerator from the given input stream.

    This enumerator will block on reading the input stream, in the default iteratee thread pool. Care must therefore be taken to ensure that this isn't a slow stream. If using this with slow input streams, consider setting the value of iteratee-threadpool-size to a value appropriate for handling the blocking.

    input

    The input stream

    chunkSize

    The size of chunks to read from the stream.

  21. def generateM[E](e: ⇒ Future[Option[E]]): Enumerator[E]

    Like play.api.libs.iteratee.Enumerator.repeatM, but the callback returns an Option, which allows the stream to be eventually terminated by returning None.

    Like play.api.libs.iteratee.Enumerator.repeatM, but the callback returns an Option, which allows the stream to be eventually terminated by returning None.

    e

    The input function. Returns a future eventually redeemed with Some value if there is input to pass, or a future eventually redeemed with None if the end of the stream has been reached.

  22. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  24. def interleave[E1, E2 >: E1](e1: Enumerator[E1], e2: Enumerator[E2]): Enumerator[E2]

    Interleave two enumerators together.

    Interleave two enumerators together.

    Interleaving is done based on whichever enumerator next has input ready, if both have input ready, the order is undefined.

  25. def interleave[E](es: Seq[Enumerator[E]]): Enumerator[E]

    Interleave multiple enumerators together.

    Interleave multiple enumerators together.

    Interleaving is done based on whichever enumerator next has input ready, if multiple have input ready, the order is undefined.

  26. def interleave[E](e1: Enumerator[E], es: Enumerator[E]*): Enumerator[E]

    Interleave multiple enumerators together.

    Interleave multiple enumerators together.

    Interleaving is done based on whichever enumerator next has input ready, if multiple have input ready, the order is undefined.

  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  31. def outputStream(a: (OutputStream) ⇒ Unit): Enumerator[Array[Byte]]

    Create an Enumerator of bytes with an OutputStream.

    Create an Enumerator of bytes with an OutputStream.

    Not that calls to write will not block, so if the iteratee that is being fed to is slow to consume the input, the OutputStream will not push back. This means it should not be used with large streams since there is a risk of running out of memory.

    a

    A callback that provides the output stream when this enumerator is written to an iteratee.

  32. def repeat[E](e: ⇒ E): Enumerator[E]

    Repeat the given input function indefinitely.

    Repeat the given input function indefinitely.

    e

    The input function.

  33. def repeatM[E](e: ⇒ Future[E]): Enumerator[E]

    Like play.api.libs.iteratee.Enumerator.repeat, but allows repeated values to be asynchronously fetched.

    Like play.api.libs.iteratee.Enumerator.repeat, but allows repeated values to be asynchronously fetched.

    e

    The input function

  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  35. def toString(): String

    Definition Classes
    AnyRef → Any
  36. def unfold[S, E](s: S)(f: (S) ⇒ Option[(S, E)]): Enumerator[E]

    Unfold a value of type S into input for an enumerator.

    Unfold a value of type S into input for an enumerator.

    For example, the following would enumerate the elements of a list, implementing the same behavior as Enumerator.enumerate:

    Enumerator.sequence[List[Int], Int]{ list =>
    list.headOption.map(input => list.tail -> input)
    }
    s

    The value to unfold

    f

    The unfolding function. This will take the value, and return some tuple of the next value to unfold and the next input, or none if the value is completely unfolded.

  37. def unfoldM[S, E](s: S)(f: (S) ⇒ Future[Option[(S, E)]]): Enumerator[E]

    Like play.api.libs.iteratee.Enumerator.unfold, but allows the unfolding to be done asynchronously.

    Like play.api.libs.iteratee.Enumerator.unfold, but allows the unfolding to be done asynchronously.

    s

    The value to unfold

    f

    The unfolding function. This will take the value, and return a future for some tuple of the next value to unfold and the next input, or none if the value is completely unfolded.

  38. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  39. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  40. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Deprecated Value Members

  1. def fromCallback[E](retriever: () ⇒ Future[Option[E]], onComplete: () ⇒ Unit, onError: (String, Input[E]) ⇒ Unit): Enumerator[E]

    Annotations
    @deprecated
    Deprecated

    (Since version 2.1.0) use Enumerator.generateM instead

  2. def imperative[E](onStart: () ⇒ Unit, onComplete: () ⇒ Unit, onError: (String, Input[E]) ⇒ Unit): PushEnumerator[E]

    Annotations
    @deprecated
    Deprecated

    (Since version 2.1.0) use Concurrent.broadcast instead

  3. def pushee[E](onStart: (Pushee[E]) ⇒ Unit, onComplete: () ⇒ Unit, onError: (String, Input[E]) ⇒ Unit): Enumerator[E]

    Annotations
    @deprecated
    Deprecated

    (Since version 2.1.0) use Concurrent.unicast instead

Inherited from AnyRef

Inherited from Any

Ungrouped