Regexp-matching large files

Hi all,

I'm trying to write a program that will process several large text files.The program should perform regexp matching on each file, and retrieve the tidbits of data that match the pattern. The text file is basically a single line of text which could be several megabytes in size.

I could, of course, each file into memory, and use the Pattern.matcher.find... API to extract the data I need. But this strikes me as inefficient. Is there a way of streaming the data directly from the file into the matcher, without storing it in a temporary String ?

[573 byte] By [Bugmastera] at [2007-10-2 4:25:49]
# 1
Pattern.matcher takes a CharSequence. It should be fairly simple for you to write a CharSequence which wraps a RandomAccessFile, although you may find it hard to get good cache locality, and you'll probably want to fudge the implementation of CharSequence.toString().
YAT_Archivista at 2007-7-15 23:53:59 > top of Java-index,Other Topics,Algorithms...