Regex search pattern in very large file

后端 未结 2 2055
名媛妹妹
名媛妹妹 2020-12-16 20:18

I\'d like to search pattern in very large file (f.e above 1 GB) that consists of single line. It is not possible to load it into memory. Currently, I use BufferedRead

2条回答
  •  渐次进展
    2020-12-16 21:05

    I think the solution for you would be to implement CharSequence as a wrapper over very large text files.

    Why? Because building a Matcher from a Pattern takes a CharSequence as an argument.

    Of course, easier said than done... But then you only have three methods to implement, so that shouldn't be too hard...


    EDIT I took the plunge and I ate my own dog's food. The "worst part" is that it actually works!

提交回复
热议问题