code: @Override
    public int read(String path, Pointer buf, @size_t long size, @off_t long offset,
        FuseFileInfo fi) {
  
      if (size > Integer.MAX_VALUE) {
        LOG.error("Cannot read more than Integer.MAX_VALUE");
        return -ErrorCodes.EINVAL();
      }
      LOG.trace("read({}, {}, {})", path, size, offset);
      final int sz = (int) size;
      final long fd = fi.fh.get();
      OpenFileEntry oe = mOpenFiles.getFirstByField(ID_INDEX, fd);
      if (oe == null) {
        LOG.error("Cannot find fd for {} in table", path);
        return -ErrorCodes.EBADFD();
      }
  
      int rd = 0;
      int nread = 0;
      if (oe.getIn() == null) {
        LOG.error("{} was not open for reading", path);
        return -ErrorCodes.EBADFD();
      }
      try {
        oe.getIn().seek(offset);
        final byte[] dest = new byte[sz];
        while (rd >= 0 && nread < size) {
          rd = oe.getIn().read(dest, nread, sz - nread);
          if (rd >= 0) {
            nread += rd;
          }
        }
  
        if (nread == -1) { // EOF
          nread = 0;
        } else if (nread > 0) {
          buf.put(0, dest, 0, nread);
        }
      } catch (Throwable t) {
        LOG.error("Failed to read file {}", path, t);
        return AlluxioFuseUtils.getErrorCode(t);
      }
  
      return nread;
    }
docs: Reads data from an open file.
  
  @param path the FS path of the file to read
  @param buf FUSE buffer to fill with data read
  @param size how many bytes to read. The maximum value that is accepted
  on this method is {@link Integer#MAX_VALUE} (note that current
  FUSE implementation will call this method with a size of
  at most 128K).
  @param offset offset of the read operation
  @param fi FileInfo data structure kept by FUSE
  @return the number of bytes read or 0 on EOF. A negative
  value on error