public byte[] read(int begin, int length) throws IOException {

        if (!isAvaiable(begin, length)) {
            throw new EOFException("Data not available " + "begin: " + begin + " length: " + length);
        }
        int filePieceIndex = findFilePieceIndex(begin);
        FilePieceMapper filePiece = files.get(filePieceIndex);
        byte[] block = new byte[length];

        int readBytes = 0;
        while (readBytes < length) {
            RandomAccessFile raf = filePiece.getFile();
            Long seek = filePiece.getFileOffset() + ((begin + readBytes) - filePiece.getPieceOffset());
            raf.seek(seek);

            int byteToRead = length - readBytes;
            Long byteAvaiableInThisFile = raf.length() - seek;

            Long byteAvaiableToRead = byteToRead < byteAvaiableInThisFile ? byteToRead : byteAvaiableInThisFile;
            raf.readFully(block, readBytes, byteAvaiableToRead.intValue());
            readBytes += byteAvaiableToRead.intValue();

            if (byteAvaiableToRead.equals(byteAvaiableInThisFile) && readBytes < length) {
                filePiece = files.get(++filePieceIndex);
            }
        }

        return block;
    }