regexp in binary files

  • Thread starter Michael Reppisch
  • Start date
M

Michael Reppisch

Hi Ng,

i am experiencing a very bad performance when grepping in binary files.
For Text files this seems to be ok.

i'm basically doing the following:

Pattern pattern = Pattern.compile("(viele|ausdruecke|wie|dieser)");
Charset charset = Charset.forName("ISO-8859-15");
CharsetDecoder decoder = charset.newDecoder();
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, (int)
fc.size());
CharBuffer cb = decoder.decode(bb);
Matcher lm = lpattern.matcher(cb);
while (lm.find()) { ...

I allso tried to use multiline or dotall options with no better performance.
Any Ideas, what i'm doing wrong?

Regards,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top