开发者

Java library to split text into smaller files

I am looking for a java library that allows me to specify max size or max number of lines in output files, and then splits a large xml/text file into smaller files.

I saw that there is a 2 year old question on SO for the same, however the ans开发者_如何学运维wers there were for specific cloud platforms....I just want a library for use in java desktop apps.


You could use Guava CountingOutputStream to keep track of how much data is written to a file. Write one line at a time, check the number of bytes written and once you exceed the threshold close the file and open a new one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜