My large_file.txt
contains <tag>
to represent data such as parents, childs and so on. My large_file.txt
format is not xml format.
I want to read large_file.txt
size 100 MB as a one string, then using String matching to get my data as a object.
Any help please?
Thanks in advance
I want to read large_file.txt size 100 MB as a one string
You really don't want to do that. You want to do anything you can to avoid it. You should always aim to process files a piece at a time. What happens when the file gets 10 times the size? 100? 1000?
You can use Jakarta Regexp 's StreamCharacterIterator . This way you can directly apply string matching on the file without reading it first into a String
object.
Otherwise you can use Commons IO's FileUtils
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.