docs: @Override
      public int read(byte[] b, int off, int len) throws IOException {
          if (max >= 0 && pos >= max) {
              return -1;
          }
          long maxRead = max >= 0 ? Math.min(len, max - pos) : len;
          int bytesRead = in.read(b, off, (int) maxRead);
  
          if (bytesRead == -1) {
              return -1;
          }
  
          pos += bytesRead;
          return bytesRead;
      }