public void readBlocks(int blocks)
    throws IOException, TarMalformatException {

        /* int for blocks should support sizes up to about 1T, according to
         * my off-the-cuff calculations */
        if (compressionType
                != TarFileOutputStream.Compression.NO_COMPRESSION) {
            readCompressedBlocks(blocks);

            return;
        }

        int i = readStream.read(readBuffer, 0, blocks * 512);

        bytesRead += i;

        if (i != blocks * 512) {
            throw new TarMalformatException(
                RB.singleton.getString(RB.INSUFFICIENT_READ, blocks * 512, i));
        }
    }
public void readBlocks ( int blocks ) throws IOException , TarMalformatException { if ( compressionType != TarFileOutputStream . Compression . NO_COMPRESSION ) { readCompressedBlocks ( blocks ) ; return ; } int i = readStream . read ( readBuffer , 0 , blocks * 512 ) ; bytesRead += i ; if ( i != blocks * 512 ) { throw new TarMalformatException ( RB . singleton . getString ( RB . INSUFFICIENT_READ , blocks * 512 , i ) ) ; } }
readBlocks(int) is the method that USERS of this class should use to
read file data from the tar file.
This method reads from the tar file and writes to the readBuffer array.
<P>
This class and subclasses should read from the underlying readStream
<b>ONLY WITH THIS METHOD</b>.
That way we can be confident that bytesRead will always be accurate.
<P>
This method is different from a typical Java byte array read command
in that when reading tar files <OL>
<LI>we always know ahead-of-time how many bytes we should read, and
<LI>we always want to read quantities of bytes in multiples of 512.
</OL>

@param blocks  How many 512 blocks to read.
@throws IOException for an I/O error on the underlying InputStream
@throws TarMalformatException if no I/O error occurred, but we failed to
read the exact number of bytes requested.