This content has been marked as final. Show 3 replies
(a) Get a CharBuffer from the ByteBuffer
(b) Decode it to a String
(c) Construct a StringReader
(d) Construct a StreamTokenizer.
At about point (b) you have already lost most of the advantage of using a MappedByteBuffer: you may as well use a FileReader.
There is a way to use StreamTokenizer with FileChannel.
But no way to use StreamTokenizer with MappedByteBuffer?
FileChannel fc = new FileInputStream(file)).getChannel(); BufferedInputStream r = new BufferedInputStream(Channels.newInputStream(fc)); StreamTokenizer st = new StreamTokenizer(r);
I just answered that.
But it's pointless. You will have two copies of the data in memory, for a start.