java - Optimal use of BufferedWriter for repeated writing of "small' amounts of data in Android -
context
i have program needs store sensor data file. objective is: collect , store information fast possible.
program flow
currently, i'm doing following:
- acquire sensor data in list (through
collections.synchronizedlistthread-safe) - if list exceeds given threshold (at moment 10 000 entries), store list file.
saving (to file) happens in thread optimise application performance.
question(s)
so have following questions regarding optimal use of bufferedwriter application/use-case:
- should use write method of
bufferedwriterwhen receiving sensor data. , throw away list. - should close
bufferedwriterevery time i've written list file? thereby repeatedly opening , closing bufferedwriters (approximately every 10 seconds)? - or should keep
bufferedwriteropen long listen sensor data?
why posted on stackoverflow , not android enthusiast
this posted on because general coding problem, i.e. not specific android platform. issue lies here in fact need store "small" amounts of data repeatedly without interfering rapid data acquisition functions.
Comments
Post a Comment