@Override
    public void readFully(long position, byte[] buffer, int offset, int length)
            throws IOException
    {
        int totalBytesRead = 0;
        while (totalBytesRead < length) {
            int bytesRead = read(
                    position + totalBytesRead,
                    buffer,
                    offset + totalBytesRead,
                    length - totalBytesRead);
            if (bytesRead == -1) {
                throw new EOFException();
            }
            totalBytesRead += bytesRead;
        }
    }
@Test
    public void testValidateDataEnabledWithDataMatched()
            throws IOException
    {
        byte[] inputData = new byte[] {1, 2, 3};
        FSDataInputStream dataTierInputStream = new TestFSDataInputStream(inputData);
        FSDataInputStream fileInStream = new TestFSDataInputStream(inputData);
        CacheValidatingInputStream fileInputStream = new CacheValidatingInputStream(fileInStream, dataTierInputStream);
        byte[] buffer = new byte[3];
        fileInputStream.readFully(0, buffer, 0, buffer.length);
        validateBuffer(inputData, 0, buffer, 0, inputData.length);
    }