Skip to content

Commit 25c073e

Browse files
committed
refs #100 make readNext method deprecated
1 parent a59e218 commit 25c073e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileReader.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class CsvFileReader internal constructor(
3232
* @return return fields in row as List<String>.
3333
* or return null, if all line are already read.
3434
*/
35+
@Deprecated("We are considering making it a private method. If you have feedback, please comment on Issue #100.")
3536
fun readNext(): List<String>? {
3637
return readUntilNextCsvRow("")
3738
}
@@ -42,12 +43,13 @@ class CsvFileReader internal constructor(
4243
fun readAllAsSequence(fieldsNum: Int? = null): Sequence<List<String>> {
4344
var expectedNumFieldsInRow: Int? = fieldsNum
4445
return generateSequence {
45-
readNext()
46+
@Suppress("DEPRECATION") readNext()
4647
}.mapIndexedNotNull { idx, row ->
4748
// If no expected number of fields was passed in, then set it based on the first row.
4849
if (expectedNumFieldsInRow == null) expectedNumFieldsInRow = row.size
4950
// Assign this number to a non-nullable type to avoid need for thread-safety null checks.
5051
val numFieldsInRow: Int = expectedNumFieldsInRow ?: row.size
52+
@Suppress("DEPRECATION")
5153
if (row.size > numFieldsInRow) {
5254
if (ctx.excessFieldsRowBehaviour == ExcessFieldsRowBehaviour.TRIM) {
5355
logger.info { "trimming excess rows. [csv row num = ${idx + 1}, fields num = ${row.size}, fields num of row = $numFieldsInRow]" }
@@ -82,6 +84,7 @@ class CsvFileReader internal constructor(
8284
* read all csv rows as Sequence with header information
8385
*/
8486
fun readAllWithHeaderAsSequence(): Sequence<Map<String, String>> {
87+
@Suppress("DEPRECATION")
8588
var headers = readNext() ?: return emptySequence()
8689
if (ctx.autoRenameDuplicateHeaders) {
8790
headers = deduplicateHeaders(headers)

0 commit comments

Comments
 (0)