The Sun Documentation for DataInput.skipBytes states that it "makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes. However, it may skip over some smaller number of bytes, possibly zero. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility."
Other than reaching end of file, why might
skipBytes()not skip the right number of bytes? (TheDataInputStreamI am using will either be wrapping aFileInputStreamor aPipedInputStream.)If I definitely want to skip n bytes and throw an
EOFExceptionif this causes me to go to the end of the file, should I usereadFully()and ignore the resulting byte array? Or is there a better way?