@Override
  public int read(byte[] b, int off, int len) throws IOException {
    assertOpen();

    checkAndFetchNextChunk();

    if (null == chunk) {
      return -1;
    }

    int read = 0;
    while (len > 0) {
      final int min = Math.min(remaining(), len);
      System.arraycopy(chunk, chunkPosition, b, off, min);
      off += min;
      len -= min;
      chunkPosition += min;
      read += min;

      if (len > 0) {
        // we read to the end of the chunk, fetch another.
        nextChunk();
        if (null == chunk) {
          break;
        }
      }
    }

    return read;
  }
An input stream that reads chunks from a File saved in the region. This input stream will keep
going back to the region to look for chunks until nothing is found.
geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/FileInputStream.java