Packages

  • package root
    Definition Classes
    root
  • package fs2
    Definition Classes
    root
  • package io

    Provides various ways to work with streams that perform IO.

    Provides various ways to work with streams that perform IO.

    Definition Classes
    fs2
  • package file

    Provides support for working with files.

  • package tcp

    Provides support for TCP networking.

  • package tls
  • package udp

    Provides support for UDP networking.

  • Network
  • Watcher

package io

Provides various ways to work with streams that perform IO.

Source
io.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. io
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package file

    Provides support for working with files.

  2. package tcp

    Provides support for TCP networking.

  3. package tls
  4. package udp

    Provides support for UDP networking.

Type Members

  1. sealed trait Network[F[_]] extends AnyRef

    Provides the ability to work with TCP, UDP, and TLS.

    Provides the ability to work with TCP, UDP, and TLS.

    Example:
    1. import fs2.Stream
      import fs2.io.{Network, udp}
      
      def send[F[_]: Network](socketGroup: udp.SocketGroup, packet: udp.Packet): F[Unit] =
        socketGroup.open().use { socket =>
          socket.write(packet)
        }

      In this example, the F[_] parameter to send requires the Network constraint instead of requiring the much more powerful Async. An instance is available for any effect F which has an Async[F] instance.

  2. sealed abstract class Watcher[F[_]] extends AnyRef

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

Value Members

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

    Reads all bytes from the specified InputStream with a buffer size of chunkSize.

    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.

  2. def readOutputStream[F[_]](chunkSize: Int)(f: (OutputStream) => F[Unit])(implicit arg0: Async[F]): Stream[F, Byte]

    Take a function that emits to an 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 an 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.

  3. def stdin[F[_]](bufSize: Int)(implicit arg0: Sync[F]): Stream[F, Byte]

    Stream of bytes read asynchronously from standard input.

  4. def stdinUtf8[F[_]](bufSize: Int)(implicit arg0: Sync[F]): Stream[F, String]

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

  5. def stdout[F[_]](implicit arg0: Sync[F]): Pipe[F, Byte, INothing]

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

  6. def stdoutLines[F[_], O](charset: Charset = utf8Charset)(implicit arg0: Sync[F], arg1: Show[O]): Pipe[F, O, INothing]

    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.

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

  7. def toInputStream[F[_]](implicit arg0: Async[F]): Pipe[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.

  8. def toInputStreamResource[F[_]](source: Stream[F, Byte])(implicit arg0: Async[F]): Resource[F, InputStream]

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

  9. def unsafeReadInputStream[F[_]](fis: F[InputStream], chunkSize: Int, closeAfterUse: Boolean = true)(implicit F: Sync[F]): Stream[F, Byte]

    Reads all bytes from the specified InputStream with a buffer size of chunkSize.

    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.

  10. def writeOutputStream[F[_]](fos: F[OutputStream], closeAfterUse: Boolean = true)(implicit F: Sync[F]): Pipe[F, Byte, INothing]

    Writes all bytes to the specified OutputStream.

    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.

  11. object Network
  12. object Watcher

Inherited from AnyRef

Inherited from Any

Ungrouped