I think the definition of getText should be like the
OS read() methods: the length parameter is a suggestion,
and you get told how many actually got read. This would
allow representations like GapContent to *never* allocate
memory. As it is, if you're writing a search routine
(like me) and you try something foolish like getText(0,doc.getLength(),segment)
GapContent will make a full copy of the document! What's worse,
there's no real way to avoid this since you can't tell where
the split in GapContent's buffer is (I now do getText's in
small chunks so that I avoid the huge allocation).
It may be that you actually want a new method, getTextPartial(...)
but I do believe these partial result semantics are *essential* for
a wide variety of purposes.