This provides a Buf instance which maps to a random access file pointer. This seemingly simple new API required a massive redesign of buffer based IO. Andy and I had a 40min conversation on the design - and in the end we agreed there should be only one public Buf API no matter whether the buffer is backed by RAM or file. To have this make sense the following API semantics were changed:
Buf can no longer be subclassed outside sys
Three sys subclasses: MemBuf, FileBuf, and MmapBuf (the last isn't done yet)
Buf.equals/hash is now based reference equality
Buf.toStr doesn't format contents - use toHex explicitly
Under the covers, there is fairly complicated transfer matrix to make everything efficiently handle the transfer cases b/w streams, memory, and RandomAccess. When I do File.mmap, nio.Buffer will be included into the transfer matrix.
brian Mon 25 Feb 2008
I added the following method to sys::File:
This provides a Buf instance which maps to a random access file pointer. This seemingly simple new API required a massive redesign of buffer based IO. Andy and I had a 40min conversation on the design - and in the end we agreed there should be only one public Buf API no matter whether the buffer is backed by RAM or file. To have this make sense the following API semantics were changed:
Under the covers, there is fairly complicated transfer matrix to make everything efficiently handle the transfer cases b/w streams, memory, and RandomAccess. When I do File.mmap, nio.Buffer will be included into the transfer matrix.