Shifting
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
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Reads a CSV source and returns a stream of character.
Reads a CSV source and returns a stream of character.
The caller of this function is responsible for proper resource acquisition and release. This may be done with fs2.Stream.bracket.
Character encoding has to be handled while creating scala.io.Source.
Attributes
- Note
-
This function may be less efficient than its non-shifting counterpart Plain.read, especially for small chunk sizes. This is due to scala.io.Source character-based iterator, which causes frequent thread shifts.
- Example
-
val stream = Stream .bracket(IO(Source.fromFile("input.csv")))(source => IO(source.close())) .flatMap(Reader.shifting[IO].read)
Reads a CSV source and returns a stream of character.
Reads a CSV source and returns a stream of character.
Attributes
Reads a CSV source and returns a stream of character.
Reads a CSV source and returns a stream of character.
Attributes
Reads a CSV file and returns a stream of character.
Reads a CSV file and returns a stream of character.
Attributes
- Example
-
given codec = new Codec(Charset.forName("ISO-8859-2")) val path = Path.of("data.csv") val stream = Reader.shifting[IO].read(path)
Inherited methods
Pipe converting stream with CSV source to stream of characters.
Pipe converting stream with CSV source to stream of characters.
Type parameters
- A
-
type of source
Value parameters
- codec
-
codec used to convert bytes to characters, with default JVM charset as fallback
Attributes
- Returns
-
a pipe to converter CSV source into scala.Chars
- Example
-
val stream = Stream .bracket(IO(Source.fromFile("input.csv")))(source => IO(source.close())) .through(Reader[IO].by)
- Inherited from:
- Reader
Concrete fields
Size of data chunk loaded at once when reading from source. See also FS2 Chunks.