Opens a CsvReader on the underlying resource.
Opens a CsvReader on the underlying resource.
For example:
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".asCsvReader[List[Int]](rfc).toList res0: List[ReadResult[List[Int]]] = List(Success(List(1, 2, 3)), Success(List(4, 5, 6)))
This is a convenience method only, and strictly equivalent to:
scala> CsvSource[String].reader[List[Int]]("1,2,3\n4,5,6", rfc).toList res1: List[ReadResult[List[Int]]] = List(Success(List(1, 2, 3)), Success(List(4, 5, 6)))
type each row will be decoded as.
CSV parsing behaviour.
Opens an unsafe CsvReader on the underlying resource.
Opens an unsafe CsvReader on the underlying resource.
For example:
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".asUnsafeCsvReader[List[Int]](rfc).toList res0: List[List[Int]] = List(List(1, 2, 3), List(4, 5, 6))
This is a convenience method only, and strictly equivalent to:
scala> CsvSource[String].unsafeReader[List[Int]]("1,2,3\n4,5,6", rfc).toList res1: List[List[Int]] = List(List(1, 2, 3), List(4, 5, 6))
type each row will be decoded as.
CSV parsing behaviour.
Reads the underlying resource as a CSV stream.
Reads the underlying resource as a CSV stream.
For example:
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".readCsv[List, List[Int]](rfc) res0: List[ReadResult[List[Int]]] = List(Success(List(1, 2, 3)), Success(List(4, 5, 6)))
This is a convenience method only, and strictly equivalent to:
scala> CsvSource[String].read[List, List[Int]]("1,2,3\n4,5,6", rfc) res1: List[ReadResult[List[Int]]] = List(Success(List(1, 2, 3)), Success(List(4, 5, 6)))
type of the collection in which the decoded CSV data will be stored.
type each row will be decoded as.
CSV parsing behaviour.
Reads the underlying resource as a CSV stream (unsafely).
Reads the underlying resource as a CSV stream (unsafely).
For example:
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".unsafeReadCsv[List, List[Int]](rfc) res0: List[List[Int]] = List(List(1, 2, 3), List(4, 5, 6))
This is a convenience method only, and strictly equivalent to:
scala> CsvSource[String].unsafeRead[List, List[Int]]("1,2,3\n4,5,6", rfc) res1: List[List[Int]] = List(List(1, 2, 3), List(4, 5, 6))
type of the collection in which the decoded CSV data will be stored.
type each row will be decoded as.
CSV parsing behaviour.
(Since version 0.1.18) use asCsvReader(CsvConfiguration) instead
(Since version 0.1.18) use asUnsafeCsvReader(CsvConfiguration) instead
(Since version 0.1.18) use readCsv(CsvConfiguration) instead
(Since version 0.1.18) use unsafeReadCsv(CsvConfiguration) instead
Provides useful syntax for types that have implicit instances of CsvSource in scope.
The most common use case is to turn a value into a CsvReader:
A slightly less common use case is to load an entire CSV file in memory:
Unsafe versions of these methods are also available, even if usually advised against.