Any char-based Java file I/O with arbitrary seek?

2012-01-05 Thread Andy Fingerhut
If this doesn't seem like a question for a Clojure group, I'll preface this by saying it is motivated by writing Clojure examples for a Clojure cookbook [1]. So far the examples are intended to work like the Perl examples from the 1st edition of the Perl Cookbook [2], but it may grow beyond that

Re: Any char-based Java file I/O with arbitrary seek?

2012-01-05 Thread Steve Miner
On Jan 5, 2012, at 5:07 PM, Andy Fingerhut wrote: I realize that with variable-length multi-byte character encodings like UTF-8, it would be a bad idea to seek to a random byte position and start trying to decode a UTF-8 character starting at that byte position. I'm thinking of cases

Re: Any char-based Java file I/O with arbitrary seek?

2012-01-05 Thread Linus Ericsson
How about a memory mapped file? Not lazy at all, but could be quick, given that you have enough memory. http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/MappedByteBuffer.html There can be times where a database is too low performant or clumsy for quick searching in a large utf-8 file, but