code: public Block getStoredBlock(int namespaceId, long blkid,
        boolean useOnDiskLength) throws IOException {
      lock.readLock().lock();
      try {
        ReplicaToRead replica = getReplicaToRead(namespaceId, new Block(
            blkid));
        if (replica == null) {
          return null;
        }
        File blockfile = replica.getDataFileToRead();
        if (blockfile == null) {
          return null;
        }
        
        File metafile = null;
        if (!replica.isInlineChecksum()) {
          metafile = BlockWithChecksumFileWriter.findMetaFile(blockfile, true);
          if (metafile == null) {
            return null;
          }
        }
        Block block = new Block(blkid);
        if (useOnDiskLength) {
          block.setNumBytes(replica.getBytesWritten());
        } else {
          block.setNumBytes(replica.getBytesVisible());
        }
        if (replica.isInlineChecksum()) {
          block.setGenerationStamp(BlockInlineChecksumReader
              .getGenerationStampFromInlineChecksumFile(blockfile.getName()));
        } else {
          block.setGenerationStamp(BlockWithChecksumFileReader
              .parseGenerationStampInMetaFile(blockfile, metafile));
        }
        return block;
      } finally {
        lock.readLock().unlock();
      }
    }
docs: {@inheritDoc}