June 19, 2005
The lines

#   if (bounded) {
#     if (size > high - low + pos)
#       size = high - low + pos;
#   }

in SliceStream.readBlock are wrong, it should read "high - low - pos" in both lines. Since "high" is the end of the stream, and "low + pos" is the current position, then "high - (low + pos)" = "high - low - pos" is the number of bytes left. The same goes for SliceStream.writeBlock.

As it stands, readBlock does not return 0 at the end of the slice, and writeBlock is allowed to write outside the slice, possibly overwriting other parts of the file.

Nick