[fedora-java] OT: java question: CharSequence from file

Robert Marcano robert at marcanoonline.com
Mon May 4 21:42:16 UTC 2009


On Mon, 2009-05-04 at 23:12 +0200, Christoph Höger wrote:
> Hi guys,
> 
> I need to lex a textfile as fast as possible(TM) by using a set of regex
> patterns.
> 
> Pattern expects a CharSequence as input. I used to read the input file
> into a StringBuffer completely and than start lexing (cutting of the
> part that matches in every step). 
> 
> This is not very effective from both the memory and runtime perspective.
> (ok, not so much runtime, since you _have_ to read every char anyway).
> 
> Today I just searched for some kind of delayed Buffer that would take
> the input from the reader on demand or even do it in a parallel thread.
> 
> Is there any such thing out there yet?

Check NIO
http://java.sun.com/j2se/1.5.0/docs/api/java/nio/CharBuffer.html



> 
> thanks
> 
> christoph
> --
> fedora-devel-java-list mailing list
> fedora-devel-java-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-devel-java-list




More information about the fedora-devel-java-list mailing list