Re: Piggypack Encoding/Decoding on RandomAccessFile
On Saturday, November 5, 2011 11:56:06 AM UTC-7, Jan Burse wrote:
Lew schrieb:
If you need sequential stream access to all or part of
> that data, have sequential clients work with scraps piped
> through the lower-lying direct access instances rather
> than fight over the same prey.
What is "scraps piped"? How do you eliminate the common prey
through "scraps piped"? Will you not only create a buffering
layer, but the problem will not be evaded?
Let's say you want to stream in a UTF-8 entry from the 'RandomAccessFile' (=
or any other 'DataInput'). If you attach the stream directly to the file d=
escriptor, you have to figure out exactly where to begin somehow or you wil=
l not get a validly decoded string. OTOH, the 'DataInput' already knows wh=
ere the characters begin, as it reads the source using 'readUTF()'. It can=
then make that string available via a 'StringReader' wrapper.
And no, the problem of where to start is not "evaded". It's just isolated =
to one place. The problem of conflicts between the streamed reader and the=
'DataInput' is completely evaded.
--
Lew