Implementation of resource for channels where resource needs to be flushed at the end of processing.
Like resource, but the release action may emit a final value,
useful for flushing any internal buffers.
Like resource, but the release action may emit a final value,
useful for flushing any internal buffers. NB: In the event of an
error, this final value is ignored.
Promote an effectful function to a Channel.
Create a Channel[Task,Int,Bytes] from an InputStream by
repeatedly requesting the given number of bytes.
Create a Channel[Task,Int,Bytes] from an InputStream by
repeatedly requesting the given number of bytes. The last chunk
may be less than the requested size.
This implementation requires an array allocation for each read.
To recycle the input buffer, use unsafeChunkR.
This implementation closes the InputStream when finished
or in the event of an error.
Create a Sink from an OutputStream, which will be closed
when this Process is halted.
Create a Source from a file name and optional buffer size in bytes.
Create a Sink from a file name and optional buffer size in bytes.
A Sink which, as a side effect, adds elements to the given Buffer.
Create a Process[Task,String] from the lines of a file, using
the resource combinator to ensure the file is closed
when processing the stream of lines is finished.
Generic combinator for producing a Process[Task,O] from some
effectful O source.
Generic combinator for producing a Process[Task,O] from some
effectful O source. The source is tied to some resource,
R (like a file handle) that we want to ensure is released.
See lines below for an example use.
The standard output stream, as a Sink.
The standard output stream, as a Sink. This Sink does not
emit newlines after each element. For that, use stdoutLines.
The standard output stream, as a Sink.
The standard output stream, as a Sink. This Sink emits
newlines after each element. If this is not desired, use stdout.
Create a Channel[Task,Array[Byte],Array[Bytes]] from an InputStream by
repeatedly filling the input buffer.
Create a Channel[Task,Array[Byte],Array[Bytes]] from an InputStream by
repeatedly filling the input buffer. The last chunk may be less
than the requested size.
It is safe to recyle the same buffer for consecutive reads
as long as whatever consumes this Process never stores the Array[Byte]
returned or pipes it to a combinator (like buffer) that does.
Use chunkR for a safe version of this combinator - this takes
an Int number of bytes to read and allocates a fresh Array[Byte]
for each read.
This implementation closes the InputStream when finished
or in the event of an error.
Module of
Processfunctions and combinators for file and network I/O.