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 empty[E]: Enumerator[E]

    An empty enumerator

  12. 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.

  13. 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 )
  14. def eof[A]: Enumerator[A]

    An enumerator that produces EOF and nothing else.

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

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

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

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

  19. def fromCallback1[E](retriever: (Boolean) ⇒ Future[Option[E]], onComplete: () ⇒ Unit = () => (), onError: (String, Input[E]) ⇒ Unit = (_: String, _: Input[E]) => ())(implicit ec: ExecutionContext): Enumerator[E] { val pec: scala.concurrent.ExecutionContext }

    Like play.api.libs.iteratee.Enumerator.generateM, but retriever accepts a boolean value that is true on its first call only.

    Like play.api.libs.iteratee.Enumerator.generateM, but retriever accepts a boolean value that is true on its first call only.

    retriever

    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.

    onComplete

    Called when the end of the stream is reached.

    onError

    FIXME: Never called.

    ec

    The context to execute the supplied functions with. The context is prepared on the calling thread before being used.

  20. def fromFile(file: File, chunkSize: Int = 1024 * 8)(implicit ec: ExecutionContext): 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.

  21. def fromStream(input: InputStream, chunkSize: Int = 1024 * 8)(implicit ec: ExecutionContext): 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 supplied ExecutionContext. Care must therefore be taken to ensure that this isn't a slow stream. If using this with slow input streams, make sure the ExecutionContext is appropriately configured to handle the blocking.

    input

    The input stream

    chunkSize

    The size of chunks to read from the stream.

    ec

    The ExecutionContext to execute blocking code.

  22. def generateM[E](e: ⇒ Future[Option[E]])(implicit ec: ExecutionContext): 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.

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

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

    Definition Classes
    AnyRef → Any
  25. 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.

  26. 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.

  27. 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.

  28. final def isInstanceOf[T0]: Boolean

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

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

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

    Definition Classes
    AnyRef
  32. def outputStream(a: (OutputStream) ⇒ Unit)(implicit ec: ExecutionContext): Enumerator[Array[Byte]]

    Create an Enumerator of bytes with an OutputStream.

    Create an Enumerator of bytes with an OutputStream.

    Note 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.

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

  33. def repeat[E](e: ⇒ E)(implicit ec: ExecutionContext): Enumerator[E]

    Repeat the given input function indefinitely.

    Repeat the given input function indefinitely.

    e

    The input function.

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

  34. def repeatM[E](e: ⇒ Future[E])(implicit ec: ExecutionContext): 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

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

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

    Definition Classes
    AnyRef
  36. def toString(): String

    Definition Classes
    AnyRef → Any
  37. def unfold[S, E](s: S)(f: (S) ⇒ Option[(S, E)])(implicit ec: ExecutionContext): 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.

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

  38. def unfoldM[S, E](s: S)(f: (S) ⇒ Future[Option[(S, E)]])(implicit ec: ExecutionContext): 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.

    ec

    The context to execute the supplied function with. The context is prepared on the calling thread before being used.

  39. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped