Reputation:
I've got 2 files: is it possible to read the first file (some lines but not all lines)in processing, set pause to this reading, read the second file and set the reading to pause, then repeat the processing until the end of reading files ?
Perhaps is it possible with threads ? or just we a buffer ?
Upvotes: 1
Views: 56
Reputation:
Ok I have implemented bufferReader on my processing and it worked gratefully. My generall processing went from 11.5s to 0.65s to execution with 5000lines data to analyse. So thank you :). Im' trying to run with files of 1.000.000 lines.
Upvotes: 1
Reputation: 312
Are you asking if it is possible? If so, yes it is, Java supports concurrency, just look up how it works. You could look into the readers writers problem. If you are asking how to implement that there are many examples specific to different needs, so you might need to be more specific and maybe include what you have tried so far.
If you would like to know what is the best way threads vs buffers it depends a lot on the situation, but as a minimum buffer should be enough
Upvotes: 0