Object

io.chrisdavenport.cormorant.parser

CSVParser

Related Doc: package parser

Permalink

object CSVParser

This CSVParser tries to stay fairly close to the initial specification https://tools.ietf.org/html/rfc4180

Deviations from the specification, here I have chosen to use a permissive CRLF that will accept a CRLF or a LF.

The important details are as follows 1. Each record is located on a separate line, delimited by a line break (CRLF). For example:

aaa,bbb,ccc CRLF zzz,yyy,xxx CRLF

2. The last record in the file may or may not have an ending line break. For example:

aaa,bbb,ccc CRLF zzz,yyy,xxx

3. There maybe an optional header line appearing as the first line of the file with the same format as normal record lines. This header will contain names corresponding to the fields in the file and should contain the same number of fields as the records in the rest of the file (the presence or absence of the header line should be indicated via the optional "header" parameter of this MIME type). For example:

field_name,field_name,field_name CRLF aaa,bbb,ccc CRLF zzz,yyy,xxx CRLF 4. Within the header and each record, there may be one or more fields, separated by commas. Each line should contain the same number of fields throughout the file. Spaces are considered part of a field and should not be ignored. The last field in the record must not be followed by a comma. For example:

aaa,bbb,ccc

5. Each field may or may not be enclosed in double quotes (however some programs, such as Microsoft Excel, do not use double quotes at all). If fields are not enclosed with double quotes, then double quotes may not appear inside the fields. For example:

"aaa","bbb","ccc" CRLF zzz,yyy,xxx

6. Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes. For example:

"aaa","b CRLF bb","ccc" CRLF zzz,yyy,xxx

7. If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote. For example:

"aaa","b""bb","ccc"

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CSVParser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val COMMA: Parser[Char]

    Permalink
  5. val CR: Parser[Char]

    Permalink
  6. val CRLF: Parser[(Char, Char)]

    Permalink
  7. val DQUOTE: Parser[Char]

    Permalink
  8. val LF: Parser[Char]

    Permalink
  9. val PERMISSIVE_CRLF: Parser[(Char, Char)]

    Permalink
  10. val TEXTDATA: Parser[Char]

    Permalink
  11. val TWO_DQUOTE: Parser[(Char, Char)]

    Permalink
  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. val comma: Char

    Permalink
  15. val commaS: String

    Permalink
  16. val complete-file: Parser[Complete]

    Permalink
  17. val cr: Char

    Permalink
  18. val crS: String

    Permalink
  19. val dquote: Char

    Permalink
  20. val dquoteS: String

    Permalink
  21. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  23. val escaped: Parser[Field]

    Permalink
  24. val field: Parser[Field]

    Permalink
  25. val fileBody: Parser[Rows]

    Permalink
  26. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  29. val header: Parser[Headers]

    Permalink
  30. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  31. val lf: Char

    Permalink
  32. val lfS: String

    Permalink
  33. val name: Parser[Header]

    Permalink
  34. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  35. val non-escaped: Parser[Field]

    Permalink
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. val record: Parser[Row]

    Permalink
  39. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  40. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  41. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped