Reader interface with reading operations from various sources. The I/O operations are wrapped in effect F
(e.g. cats.effect.IO), allowing deferred computation. The returned fs2.Stream allows further input processing in a very flexible, purely functional manner.
Processing I/O errors, manifested through java.io.IOException, should be handled with fs2.Stream.handleErrorWith. If not handled, they will propagate as exceptions.
Type parameters
- F
-
the effect type
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Members list
Value members
Abstract 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.
Value parameters
- source
-
the source containing CSV content
Attributes
- Returns
-
the stream of characters
- Example
-
val stream = Stream .bracket(IO(Source.fromFile("input.csv")))(source => IO(source.close())) .flatMap(Reader[IO].read)
Reads a CSV source and returns a stream of character.
Reads a CSV source and returns a stream of character.
Value parameters
- codec
-
codec used to convert bytes to characters, with default JVM charset as fallback
- fis
-
input stream containing CSV content, wrapped in effect F to defer its creation
Attributes
- Returns
-
the stream of characters
- See also
-
read(source) for more information.
- Note
-
This function does not close the input stream after use, which is different from default behavior of
fs2-io
functions takingInputStream
as parameter.
Reads a CSV source and returns a stream of character.
Reads a CSV source and returns a stream of character.
Value parameters
- codec
-
codec used to convert bytes to characters, with default JVM charset as fallback
- is
-
input stream containing CSV content
Attributes
- Returns
-
the stream of characters
- See also
-
read(source) for more information.
- Note
-
This function does not close the input stream after use, which is different from default behavior of
fs2-io
functions takingInputStream
as parameter.
Reads a CSV file and returns a stream of character.
Reads a CSV file and returns a stream of character.
Value parameters
- codec
-
codec used to convert bytes to characters, with default JVM charset as fallback
- path
-
the path to source file
Attributes
- Returns
-
the stream of characters
- Example
-
given codec = new Codec(Charset.forName("UTF-8")) val path = Path.of("data.csv") val stream = Reader[IO](1024).read(path)
Concrete 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)
Abstract fields
Size of data chunk loaded at once when reading from source. See also FS2 Chunks.