fs2.io

package fs2.io

Provides various ways to work with streams that perform IO.

Type members

Classlikes

sealed abstract class Watcher[F[_]]

Allows watching the file system for changes to directories and files by using the platform's WatchService.

Allows watching the file system for changes to directories and files by using the platform's WatchService.

Companion:
object
Source:
DeprecatedWatcher.scala
object Watcher

Types

type IOException = IOException
Source:
io.scala

Inherited types

type ClosedChannelException = ClosedChannelException
type InterruptedIOException = InterruptedIOException

Value members

Concrete methods

def readInputStream[F[_]](fis: F[InputStream], chunkSize: Int, closeAfterUse: Boolean)(implicit F: Sync[F]): Stream[F, Byte]

Reads all bytes from the specified InputStream with a buffer size of chunkSize. Set closeAfterUse to false if the InputStream should not be closed after use.

Reads all bytes from the specified InputStream with a buffer size of chunkSize. Set closeAfterUse to false if the InputStream should not be closed after use.

Source:
io.scala
def unsafeReadInputStream[F[_]](fis: F[InputStream], chunkSize: Int, closeAfterUse: Boolean)(implicit F: Sync[F]): Stream[F, Byte]

Reads all bytes from the specified InputStream with a buffer size of chunkSize. Set closeAfterUse to false if the InputStream should not be closed after use.

Reads all bytes from the specified InputStream with a buffer size of chunkSize. Set closeAfterUse to false if the InputStream should not be closed after use.

Recycles an underlying input buffer for performance. It is safe to call this as long as whatever consumes this Stream does not store the Chunk returned or pipe it to a combinator that does (e.g. buffer). Use readInputStream for a safe version.

Source:
io.scala
def writeOutputStream[F[_]](fos: F[OutputStream], closeAfterUse: Boolean)(implicit F: Sync[F]): (F, Byte) => Nothing

Writes all bytes to the specified OutputStream. Set closeAfterUse to false if the OutputStream should not be closed after use.

Writes all bytes to the specified OutputStream. Set closeAfterUse to false if the OutputStream should not be closed after use.

Each write operation is performed on the supplied execution context. Writes are blocking so the execution context should be configured appropriately.

Source:
io.scala

Inherited methods

def readClassLoaderResource[F[_]](name: String, chunkSize: Int, classLoader: ClassLoader)(implicit F: Sync[F]): Stream[F, Byte]

Stream of bytes read asynchronously from the specified classloader resource.

Stream of bytes read asynchronously from the specified classloader resource.

See also:

readClassResource for a resource relative to a class.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def readClassResource[F[_], C](name: String, chunkSize: Int)(implicit F: Sync[F], ct: ClassTag[C]): Stream[F, Byte]

Stream of bytes read asynchronously from the specified resource relative to the class C.

Stream of bytes read asynchronously from the specified resource relative to the class C.

See also:

readClassLoaderResource for a resource relative to a classloader.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def readOutputStream[F[_] : Async](chunkSize: Int)(f: OutputStream => F[Unit]): Stream[F, Byte]

Take a function that emits to a java.io.OutputStream effectfully, and return a stream which, when run, will perform that function and emit the bytes recorded in the OutputStream as an fs2.Stream

Take a function that emits to a java.io.OutputStream effectfully, and return a stream which, when run, will perform that function and emit the bytes recorded in the OutputStream as an fs2.Stream

The stream produced by this will terminate if:

  • f returns
  • f calls OutputStream#close

If none of those happens, the stream will run forever.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def stderr[F[_] : Sync]: (F, Byte) => Nothing

Pipe of bytes that writes emitted values to standard error asynchronously.

Pipe of bytes that writes emitted values to standard error asynchronously.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def stdin[F[_] : Sync](bufSize: Int): Stream[F, Byte]

Stream of bytes read asynchronously from standard input.

Stream of bytes read asynchronously from standard input.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def stdinUtf8[F[_] : Sync](bufSize: Int): Stream[F, String]

Stream of String read asynchronously from standard input decoded in UTF-8.

Stream of String read asynchronously from standard input decoded in UTF-8.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def stdout[F[_] : Sync]: (F, Byte) => Nothing

Pipe of bytes that writes emitted values to standard output asynchronously.

Pipe of bytes that writes emitted values to standard output asynchronously.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def stdoutLines[F[_] : Sync, O : Show](charset: Charset): (F, O) => Nothing

Writes this stream to standard output asynchronously, converting each element to a sequence of bytes via Show and the given Charset.

Writes this stream to standard output asynchronously, converting each element to a sequence of bytes via Show and the given Charset.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def toInputStream[F[_] : Async]: (F, Byte) => InputStream

Pipe that converts a stream of bytes to a stream that will emit a single java.io.InputStream, that is closed whenever the resulting stream terminates.

Pipe that converts a stream of bytes to a stream that will emit a single java.io.InputStream, that is closed whenever the resulting stream terminates.

If the close of resulting input stream is invoked manually, then this will await until the original stream completely terminates.

Because all InputStream methods block (including close), the resulting InputStream should be consumed on a different thread pool than the one that is backing the effect.

Note that the implementation is not thread safe -- only one thread is allowed at any time to operate on the resulting java.io.InputStream.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala
def toInputStreamResource[F[_] : Async](source: Stream[F, Byte]): Resource[F, InputStream]

Like toInputStream but returns a Resource rather than a single element stream.

Like toInputStream but returns a Resource rather than a single element stream.

Inherited from:
ioplatform (hidden)
Source:
ioplatform.scala