final class CsvSourceOps[A] extends AnyRef
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:
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".asCsvReader[List[Int]](rfc).toList res0: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
A slightly less common use case is to load an entire CSV file in memory:
scala> "1,2,3\n4,5,6".readCsv[List, List[Int]](rfc) res1: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
Unsafe versions of these methods are also available, even if usually advised against.
- Alphabetic
- By Inheritance
- CsvSourceOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val a: A
-
def
asCsvReader[B](conf: CsvConfiguration)(implicit arg0: HeaderDecoder[B], e: ReaderEngine): CsvReader[ReadResult[B]]
Opens a CsvReader on the underlying resource.
Opens a CsvReader on the underlying resource.
This is a convenience method only, and strictly equivalent to:
scala> import kantan.csv._ scala> CsvSource[String].reader[List[Int]]("1,2,3\n4,5,6", rfc).toList res1: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
- B
type each row will be decoded as.
- conf
CSV parsing behaviour.
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".asCsvReader[List[Int]](rfc).toList res0: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
Example: -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asUnsafeCsvReader[B](conf: CsvConfiguration)(implicit arg0: HeaderDecoder[B], e: ReaderEngine): CsvReader[B]
Opens an unsafe CsvReader on the underlying resource.
Opens an unsafe CsvReader on the underlying resource.
This is a convenience method only, and strictly equivalent to:
scala> import kantan.csv._ 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))
- B
type each row will be decoded as.
- conf
CSV parsing behaviour.
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))
Example: -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
readCsv[C[_], B](conf: CsvConfiguration)(implicit arg0: HeaderDecoder[B], e: ReaderEngine, factory: Factory[ReadResult[B], C[ReadResult[B]]]): C[ReadResult[B]]
Reads the underlying resource as a CSV stream.
Reads the underlying resource as a CSV stream.
This is a convenience method only, and strictly equivalent to:
scala> import kantan.csv._ scala> CsvSource[String].read[List, List[Int]]("1,2,3\n4,5,6", rfc) res1: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
- C
type of the collection in which the decoded CSV data will be stored.
- B
type each row will be decoded as.
- conf
CSV parsing behaviour.
scala> import kantan.csv._ scala> "1,2,3\n4,5,6".readCsv[List, List[Int]](rfc) res0: List[ReadResult[List[Int]]] = List(Right(List(1, 2, 3)), Right(List(4, 5, 6)))
Example: -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unsafeReadCsv[C[_], B](conf: CsvConfiguration)(implicit arg0: HeaderDecoder[B], e: ReaderEngine, factory: Factory[B, C[B]]): C[B]
Reads the underlying resource as a CSV stream (unsafely).
Reads the underlying resource as a CSV stream (unsafely).
This is a convenience method only, and strictly equivalent to:
scala> import kantan.csv._ 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))
- C
type of the collection in which the decoded CSV data will be stored.
- B
type each row will be decoded as.
- conf
CSV parsing behaviour.
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))
Example: -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
Deprecated Value Members
-
def
asCsvReader[B](sep: Char, header: Boolean)(implicit arg0: HeaderDecoder[B], e: ReaderEngine): CsvReader[ReadResult[B]]
- Annotations
- @deprecated
- Deprecated
(Since version 0.1.18) use asCsvReader(CsvConfiguration) instead
-
def
asUnsafeCsvReader[B](sep: Char, header: Boolean)(implicit arg0: HeaderDecoder[B], e: ReaderEngine): CsvReader[B]
- Annotations
- @deprecated
- Deprecated
(Since version 0.1.18) use asUnsafeCsvReader(CsvConfiguration) instead
-
def
readCsv[C[_], B](sep: Char, header: Boolean)(implicit arg0: HeaderDecoder[B], e: ReaderEngine, factory: Factory[ReadResult[B], C[ReadResult[B]]]): C[ReadResult[B]]
- Annotations
- @deprecated
- Deprecated
(Since version 0.1.18) use readCsv(CsvConfiguration) instead
-
def
unsafeReadCsv[C[_], B](sep: Char, header: Boolean)(e: ReaderEngine, factory: Factory[B, C[B]])(implicit arg0: HeaderDecoder[B]): C[B]
- Annotations
- @deprecated
- Deprecated
(Since version 0.1.18) use unsafeReadCsv(CsvConfiguration) instead