code: @GuardedBy("lock")
      private int getLengthUntilNextEntry(long startOffset, int maxLength) {
          ReadIndexEntry ceilingEntry = this.indexEntries.getCeiling(startOffset);
          if (ceilingEntry != null) {
              maxLength = (int) Math.min(maxLength, ceilingEntry.getStreamSegmentOffset() - startOffset);
          }
  
          return maxLength;
      }
docs: Returns the length from the given offset until the beginning of the next index entry. If no such entry exists, or
  if the length is greater than maxLength, then maxLength is returned.
  
  @param startOffset The offset to search from.
  @param maxLength   The maximum allowed length.
  @return The result.