@Override
  public int read(ByteBuffer bb) throws IOException {
    // Simple implementation for now - currently Parquet uses heap buffers.
    int result = -1;
    if (bb.hasArray()) {
      result = readInternal(bb.array(), bb.arrayOffset(), bb.remaining());
      if (result > 0) {
        bb.position(bb.position() + result);
      }
    } else {
      byte[] b = new byte[bb.remaining()];
      result = readInternal(b, 0, bb.remaining());
      bb.put(b, 0, result);
    }
    return result;
  }
The Parquet InputFile implementation that allows the reader to
read the footer from cache without being aware of the latter.
This implements both InputFile and the InputStream that the reader gets from InputFile.
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/ParquetFooterInputFromCache.java