@Override
  public int read() throws IOException {
    if (position >= length) return -1;
    ++position;
    ByteBuffer data = cacheData[bufferIx].getByteBufferRaw();
    int bp = bufferPos;
    ++bufferPos;
    if (bufferPos == data.remaining()) {
      ++bufferIx; // The first line check should handle the OOB.
      bufferPos = 0;
    }
    return data.get(data.position() + bp) & 0xFF;
  }
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