On Tue, 12 Feb 2008, Daniel Noll wrote:
 - The file loaded from disk is merely one big ByteBuffer. (easy)

 - A block in the file would be a ByteBuffer created as a subset over the
   larger file ByteBuffer (easy, Java allows for this already)

This looks like it might be a little bit of work. It looks to me like most of the block creation/reading is done on the input stream one block at a time, with eof checks etc in there. So, I guess we'd need to change to just reading the whole lot into some sort of growable byte array, wrap that as a ByteBuffer, then change the block code to work on that.

 - A document would be a ByteBuffer created as a composite ByteBuffer over
   the blocks which make it up (slightly less easy, requires custom
   ByteBuffer subclass to be written but such a thing will be a useful
   utility and probably should be in Commons if not the JRE itself.)

I guess we could do the blocks first, then have them return byte arrays to maintain current behaviour. Then, we write the new bytebuffer stuff, and I guess finally we tweak things like RecordInputStream

Of course if someone writes to a document it's a different story. You would need to create a new ByteBuffer so as not to damage the original file (unless you design it to write to the original file -- probably harder.)

Currently, we just dump it all into a fresh output stream. I guess we could keep going with that, or possibly dump into a fresh ByteBuffer, which we can also pass into an output stream if wanted?

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to