code: private long findMaxLen(long pLength) {
          if (hasLength && left < pLength) {
              return Math.max(left, 0);
          }
          else {
              return Math.max(pLength, 0);
          }
      }
docs: Finds the maximum number of bytes we can read or skip, from this stream.
  The number will be in the range {@code [0 ... bytes left]}.
  
  @param pLength the requested length
  @return the maximum number of bytes to read