https://github.com/lancelet/csvee
CSV library in Scala
https://github.com/lancelet/csvee
Last synced: 3 months ago
JSON representation
CSV library in Scala
- Host: GitHub
- URL: https://github.com/lancelet/csvee
- Owner: lancelet
- License: bsd-3-clause
- Created: 2016-08-17T01:01:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-22T07:42:33.000Z (over 8 years ago)
- Last Synced: 2025-01-13T21:27:46.368Z (4 months ago)
- Language: Scala
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
csvee
> CSV library in Scala
`csvee` is a small, efficient library for reading and writing
[RFC 4180](https://www.ietf.org/rfc/rfc4180.txt)-compatible CSV files in
Scala. It handles correct escaping of fields in CSV.## Getting Started
`csvee` currently only encodes and decodes single lines from a CSV file (both
assumed to be without newlines):```scala
import cats.Xor
import org.csvee.{CsvEncode, CsvDecode, CsvError}object Example {
val encoder = CsvEncode()
val decoder = CsvDecode()val fields = Vector("csvee", "42", ", comma", "quote \"")
val encoded: String = encoder.encodeLine(fields)
val decoded: Xor[CsvError, Vector[String]] = decoder.decodeLine(encoded)
// or, with a size hint
val decodedSizeHint = decoder.decodeLine(encoded, Some(fields.length))
}
```## Why not OpenCSV?
[OpenCSV](http://opencsv.sourceforge.net/) is the project which prompted the
original creation of `csvee`. Deficiencies were identified because OpenCSV:
- was unable to round-trip a field containing a single backslash character
(as of version 3.8),
- is closely coupled to the `Reader` and `Writer` abstractions in Java,
- is hosted on SourceForge,
- is Java-based and throws exceptions.