@@ -57,8 +57,8 @@ public class CSV(private val delimiter: Char = ',') : SupportedDataFrameFormat {
57
57
}
58
58
59
59
public 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 ())
62
62
}
63
63
64
64
private val defaultCharset = Charsets .UTF_8
@@ -73,11 +73,15 @@ internal fun isCompressed(url: URL) = isCompressed(url.path)
73
73
@Interpretable(" ReadDelimStr" )
74
74
public fun DataFrame.Companion.readDelimStr (
75
75
text : String ,
76
+ delimiter : Char = ',',
76
77
colTypes : Map <String , ColType > = mapOf(),
77
78
skipLines : Int = 0,
78
79
readLines : Int? = null,
79
80
): 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
+ }
81
85
82
86
public fun DataFrame.Companion.read (
83
87
fileOrUrl : String ,
@@ -212,7 +216,7 @@ public fun asURL(fileOrUrl: String): URL = (
212
216
).toURL()
213
217
214
218
private 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( )
216
220
217
221
public fun DataFrame.Companion.readDelim (
218
222
inStream : InputStream ,
@@ -268,7 +272,7 @@ public fun ColType.toType(): KClass<out Any> = when (this) {
268
272
269
273
public fun DataFrame.Companion.readDelim (
270
274
reader : Reader ,
271
- format : CSVFormat = CSVFormat .DEFAULT .withHeader (),
275
+ format : CSVFormat = CSVFormat .DEFAULT .builder().setHeader().build (),
272
276
colTypes : Map <String , ColType > = mapOf(),
273
277
skipLines : Int = 0,
274
278
readLines : Int? = null,
0 commit comments