Reader

info.fingo.spata.io.Reader
See theReader companion trait
object Reader

Utility to read external data and provide stream of characters. It is used through one of its inner classes:

The reading functions in Reader.Shifting, except the one reading from scala.io.Source, use fs2-io library.

In every case, the caller of function taking resource (scala.io.Source or java.io.InputStream) as a parameter is responsible for its cleanup.

Functions reading binary data (from java.io.InputStream or taking java.nio.file.Path) use given scala.io.Codec to decode input data. If not provided, the default JVM charset is used.

For input data encoded in UTF, the byte order mark (BOM) is removed automatically. This is done even for functions reading from already decoded scala.io.Source as long as the given instance of scala.io.Codec with UTF charset is provided.

All of above applies not only to read functions but also to apply and by, which internally make use of read.

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Reader.type

Members list

Type members

Classlikes

object CSV

Given instances to witness that given type is supported by Reader as CSV source.

Given instances to witness that given type is supported by Reader as CSV source.

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
CSV.type
sealed trait CSV[-A]

Representation of CSV data source, used to witness that certain sources may be used by read operations.

Representation of CSV data source, used to witness that certain sources may be used by read operations.

Attributes

See also

CSV object.

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object inputStreamWitness.type
object pathWitness.type
object sourceWitness.type
final class Plain[F[_]] extends Reader[F]

Reader which executes I/O operations on current thread, without context (thread) shifting.

Reader which executes I/O operations on current thread, without context (thread) shifting.

Type parameters

F

the effect type, with type class providing support for delayed execution (typically cats.effect.IO) and logging (provided internally by spata)

Value parameters

chunkSize

size of data chunk

Attributes

Supertypes
trait Reader[F]
class Object
trait Matchable
class Any
final class Shifting[F[_]] extends Reader[F]

Reader which shifts I/O operations to a thread pool provided for blocking operations. Uses the built-in internal blocking thread pool.

Reader which shifts I/O operations to a thread pool provided for blocking operations. Uses the built-in internal blocking thread pool.

Type parameters

F

the effect type, with type classes providing support for suspended execution (typically cats.effect.IO), Async execution environment with blocking and non-blocking thread pools (to shift back and forth) and logging (provided internally by spata).

Value parameters

chunkSize

size of data chunk

Attributes

Supertypes
trait Reader[F]
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[F[_] : Logger](chunkSize: Int): Shifting[F]

Alias for shifting.

Alias for shifting.

Type parameters

F

the effect type, with type classes providing support for suspended execution (typically cats.effect.IO), Async execution environment with blocking and non-blocking thread pools (to shift back and forth) and logging (provided internally by spata).

Value parameters

chunkSize

size of data chunk - see FS2 Chunks.

Attributes

Returns

Reader with support for thread shifting

def apply[F[_] : Logger]: Shifting[F]

Alias for shifting.

Alias for shifting.

Type parameters

F

the effect type, with type classes providing support for suspended execution (typically cats.effect.IO), Async execution environment with blocking and non-blocking thread pools (to shift back and forth) and logging (provided internally by spata).

Attributes

Returns

Reader with support for thread shifting

def plain[F[_] : Logger](chunkSize: Int): Plain[F]

Provides basic reader executing I/O on current thread.

Provides basic reader executing I/O on current thread.

Type parameters

F

the effect type, with type class providing support for delayed execution (typically cats.effect.IO) and logging (provided internally by spata)

Value parameters

chunkSize

size of data chunk

Attributes

Returns

basic Reader

def plain[F[_] : Logger]: Plain[F]

Provides basic reader executing I/O on current thread. Uses default chunk size.

Provides basic reader executing I/O on current thread. Uses default chunk size.

Type parameters

F

the effect type, with type class providing support for delayed execution (typically cats.effect.IO) and logging (provided internally by spata)

Attributes

Returns

basic Reader

def shifting[F[_] : Logger](chunkSize: Int): Shifting[F]

Provides reader with support of context (thread) shifting for I/O operations. Uses the built-in internal blocking thread pool.

Provides reader with support of context (thread) shifting for I/O operations. Uses the built-in internal blocking thread pool.

Type parameters

F

the effect type, with type classes providing support for suspended execution (typically cats.effect.IO), Async execution environment with blocking and non-blocking thread pools (to shift back and forth) and logging (provided internally by spata).

Value parameters

chunkSize

size of data chunk

Attributes

Returns

Reader with support for thread shifting

def shifting[F[_] : Logger]: Shifting[F]

Provides reader with support of context (thread) shifting for I/O operations. Uses the built-in internal blocking thread pool and default chunks size.

Provides reader with support of context (thread) shifting for I/O operations. Uses the built-in internal blocking thread pool and default chunks size.

Type parameters

F

the effect type, with type classes providing support for suspended execution (typically cats.effect.IO), Async execution environment with blocking and non-blocking thread pools (to shift back and forth) and logging (provided internally by spata).

Attributes

Returns

Reader with support for thread shifting

Concrete fields

Default size of data chunk: 4096. Read more about chunks in see FS2 Guide.

Default size of data chunk: 4096. Read more about chunks in see FS2 Guide.

Attributes