@@ -57,8 +57,8 @@ public class CSV(private val delimiter: Char = ',') : SupportedDataFrameFormat {
5757}
5858
5959public enum class CSVType (public val format : CSVFormat ) {
60- DEFAULT (CSVFormat .DEFAULT .withAllowMissingColumnNames ().withIgnoreSurroundingSpaces ()),
61- TDF (CSVFormat .TDF .withAllowMissingColumnNames ())
60+ DEFAULT (CSVFormat .DEFAULT .builder ().setAllowMissingColumnNames( true ).setIgnoreSurroundingSpaces( true ).build ()),
61+ TDF (CSVFormat .TDF .builder().setAllowMissingColumnNames( true ).build ())
6262}
6363
6464private val defaultCharset = Charsets .UTF_8
@@ -73,11 +73,15 @@ internal fun isCompressed(url: URL) = isCompressed(url.path)
7373@Interpretable(" ReadDelimStr" )
7474public fun DataFrame.Companion.readDelimStr (
7575 text : String ,
76+ delimiter : Char = ',',
7677 colTypes : Map <String , ColType > = mapOf(),
7778 skipLines : Int = 0,
7879 readLines : Int? = null,
7980): DataFrame <* > =
80- StringReader (text).use { readDelim(it, CSVType .DEFAULT .format.withHeader(), colTypes, skipLines, readLines) }
81+ StringReader (text).use {
82+ val format = CSVType .DEFAULT .format.builder().setHeader().setDelimiter(delimiter).build()
83+ readDelim(it, format, colTypes, skipLines, readLines)
84+ }
8185
8286public fun DataFrame.Companion.read (
8387 fileOrUrl : String ,
@@ -212,7 +216,7 @@ public fun asURL(fileOrUrl: String): URL = (
212216 ).toURL()
213217
214218private fun getFormat (type : CSVType , delimiter : Char , header : List <String >, duplicate : Boolean ): CSVFormat =
215- type.format.withDelimiter( delimiter).withHeader (* header.toTypedArray()).withAllowDuplicateHeaderNames (duplicate)
219+ type.format.builder().setDelimiter( delimiter).setHeader (* header.toTypedArray()).setAllowMissingColumnNames (duplicate).build( )
216220
217221public fun DataFrame.Companion.readDelim (
218222 inStream : InputStream ,
@@ -268,7 +272,7 @@ public fun ColType.toType(): KClass<out Any> = when (this) {
268272
269273public fun DataFrame.Companion.readDelim (
270274 reader : Reader ,
271- format : CSVFormat = CSVFormat .DEFAULT .withHeader (),
275+ format : CSVFormat = CSVFormat .DEFAULT .builder().setHeader().build (),
272276 colTypes : Map <String , ColType > = mapOf(),
273277 skipLines : Int = 0,
274278 readLines : Int? = null,
0 commit comments