boolean capped = false;
int lineCount = 0;
try {
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel fc = raf.getChannel();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
CharBuffer cb = Charset.forName("US-ASCII").decode(bb); //todo: does Derby use a different charset on a foreign PC?
Matcher lines = FULL_LINE_PATTERN.matcher(cb);
Matcher text = textSearch == null ? null : textSearch.matcher("");
max = Math.min(max, MAX_SEARCH_RESULTS);
while(lines.find()) {