case class CSVConfig extends Product with Serializable
CSV configuration used for creating CSVParser.
This config may be used as a builder to create a parser:
val parser = CSVConfig.fieldSizeLimit(1000).noHeader().get[IO]()
Field delimiter is ','
by default.
Record delimiter is '\n'
by default. When the delimiter is line feed ('\n'
, ASCII 10)
and it is preceded by carriage return ('\r'
, ASCII 13), they are treated as a single character.
Quotation mark is '"'
by default.
It is required to wrap special characters in quotes - field and record delimiters.
Quotation mark in content may appear only inside quotation marks.
It has to be doubled to be interpreted as part of actual data, not a control character.
If a field starts or end with white character it has to be wrapped in quotation marks.
In another case the white characters are stripped.
If the source has a header, which is the default, it is used as an keys to actual values and not included in data.
If there is no header, a number-based keys are created (starting from "_1"
).
If CSV records are converted to case classes, header values are used as class fields and may require remapping. This can be achieved through mapHeader:
config.mapHeader(Map("first name" -> "firstName", "last name" -> "lastName")))
or if there is no header line:
config.mapHeader(Map("_1" -> "firstName", "_2" -> "lastName")))
Header mapping may be also position-based, which is especially handy when there are duplicates in header and name-based remapping does not solve it (because it remaps all occurrences):
config.mapHeader(Map(0 -> "firstName", 1 -> "lastName")))
Field size limit is used to stop processing input when it is significantly larger then expected
and avoid OutOfMemoryError
.
This might happen if the source structure is invalid, e.g. the closing quotation mark is missing.
There is no limit by default.
- Alphabetic
- By Inheritance
- CSVConfig
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def fieldDelimiter(fd: Char): CSVConfig
Gets new config from this one by replacing field delimiter with provided one.
- val fieldDelimiter: Char
- def fieldSizeLimit(fsl: Int): CSVConfig
Gets new config from this one by replacing field size limit with provided one.
- val fieldSizeLimit: Option[Int]
- def get[F[_]]()(implicit arg0: Sync[F], arg1: Logger[F]): CSVParser[F]
Creates CSVParser from this config.
Creates CSVParser from this config.
- F
the effect type, with a type class providing support for suspended execution (typically cats.effect.IO) and logging (provided internally by spata)
- returns
parser configured according to provided settings
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val hasHeader: Boolean
- val headerMap: HeaderMap
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def mapHeader(hm: HeaderMap): CSVConfig
Remap selected fields names.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noHeader(): CSVConfig
Gets new config from this one by switching off header presence.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def quoteMark(qm: Char): CSVConfig
Gets new config from this one by replacing quotation mark with provided one.
- val quoteMark: Char
- def recordDelimiter(rd: Char): CSVConfig
Gets new config from this one by replacing record delimiter with provided one.
- val recordDelimiter: Char
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
Provides configuration description
Provides configuration description
- returns
short textual information about configuration
- Definition Classes
- CSVConfig → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])