Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toStreamWithHeaders does not remember the header-line #144

Open
ThijsBroersen opened this issue Apr 24, 2019 · 1 comment
Open

toStreamWithHeaders does not remember the header-line #144

ThijsBroersen opened this issue Apr 24, 2019 · 1 comment

Comments

@ThijsBroersen
Copy link

When calling toStreamWithHeaders.head two times it takes the headers correctly on the first call, the second call it used the next line as header-line.

@tototoshi
Copy link
Owner

Some methods like toStreamWithHeaders are not intended to be called twice since it holds iterator to read lines.

scala> CSVReader.open("a.csv")
res6: com.github.tototoshi.csv.CSVReader = com.github.tototoshi.csv.CSVReader@19dd3ae0

scala> res6.toStream.toList
res7: List[List[String]] = List(List(NAME, VALUE), List(a, 1), List(b, 2), List(c, 3))

scala> res6.toStream.toList
res8: List[List[String]] = List()

When you need to read a file twice, please open the file again with CSVReader#open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants