Comments (7)
@davidohana
Thank you for your valuable input.
In that scenario, I guess you can write csv from streaming data like below code.
If I'm not understanding your situation correctly, please give me more details.
import com.github.doyaaaaaken.kotlincsv.dsl.csvWriter
//streaming data
val rows = sequenceOf(
listOf("a", "b", "c"),
listOf("d", "e", "f")
)
csvWriter().open("test.csv") {
rows.forEach { row ->
writeRow(row)
}
}
from kotlin-csv.
Hello, in the code above, the file handle is closed at the end of the block. I get new data the I need to write to CSV every few seconds and I want to keep writing it to an open file without reopening it.
from kotlin-csv.
@davidohana
Thanks.
So, does the method openAndGetRawWriter
described below solve your problem?
val writer: CsvFileWriter = csvWriter().openAndGetRawWriter("test.csv")
writer.writeRow(listOf("a", "b", "c"))
writer.writeRow(listOf("d", "e", "f"))
writer.close()
from kotlin-csv.
Yes it should, but I didn't see such a public method.
from kotlin-csv.
@davidohana
OK, I'll do it soon. If you'd like to implement it by yourself, feel free to tell me and send pull request.
from kotlin-csv.
@davidohana
released at v0.11.0, thanks.
from kotlin-csv.
Thanks!
from kotlin-csv.
Related Issues (20)
- Make CsvFileReader.readNext() private HOT 6
- Keep input stream open HOT 2
- Optimize writeNext Method HOT 3
- The binary version of its metadata is 1.6.0, expected version is 1.4.2.
- Seeing a parsing error when quotes within text HOT 1
- Parser unable to parse csv file with lower row quantity compare with header HOT 6
- Introduce `insufficientFieldsRowBehaviour = "EMPTY_STRING"` option on CSV reader HOT 2
- How to read big csv file using your library?
- CsvFileWriter.writeRows writes line terminator even when passed list or sequence is empty HOT 3
- Allow an error interface channnel HOT 1
- Unable to parse with multiple quotes HOT 1
- Exception in thread "main" com.github.doyaaaaaken.kotlincsv.util.CSVParseFormatException: must appear escapeChar(") after escapeChar(") [rowNum = 729, colIndex = 467, char = "]
- Add support for WebAssembly HOT 2
- Use java.nio.Path instead of File
- Allow writing data with headers
- Make common ancestor for CsvReaderContext and CsvWriterContext
- Only reads 23 instead of 614 lines HOT 1
- java.lang.NoClassDefFoundError: com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslKt HOT 1
- How to set/get Header HOT 1
- Write directly to a String HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-csv.