Fix DirCache's skip over null byte padding when reading a DIRC file
Sometimes we hit EOFException while reading from a 'DIRC' file with
the new DirCache API. This was caused by BufferedInputStream.skip
skipping only part of the range we asked it to skip if the range we
asked it to skip spanned over the end of the current buffer block.
Two skip requests are necessary in this case: one to force the stream
to skip to the end of the buffer, and another to skip over data in
the source stream before reading the next buffer block into memory.
NB.skipFully handles this by abstracting the necessary loop into
a utility function, much like NB.readFully handles the necessary
read loop to ensure we read a full block of data.
DirCacheEntry and DirCache both need to use this routine to skip
over the parts of the DIRC file they do not wish to read.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>