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")
An empty enumerator
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.
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 )
An enumerator that produces EOF and nothing else.
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.
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.
Called when the end of the stream is reached.
Called when an error occurs in the iteratee
The context to execute the supplied functions with. The context is prepared on the calling thread before being used.
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.
The file to create the enumerator from.
The size of chunks to read from the file.
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.
The file path to create the enumerator from.
The size of chunks to read from the file.
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.
The input stream
The size of chunks to read from the stream.
The ExecutionContext to execute blocking code.
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.
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.
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.
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.
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.
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 callback that provides the output stream when this enumerator is written to an iteratee.
The context to execute the supplied function with. The context is prepared on the calling thread before being used.
Repeat the given input function indefinitely.
Repeat the given input function indefinitely.
The input function.
The context to execute the supplied function with. The context is prepared on the calling thread before being used.
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.
The input function
The context to execute the supplied function with. The context is prepared on the calling thread before being used.
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) }
The value to unfold
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.
The context to execute the supplied function with. The context is prepared on the calling thread before being used.
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.
The value to unfold
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.
The context to execute the supplied function with. The context is prepared on the calling thread before being used.
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.