docs: @Override
      public int read(byte[] out, final int off, final int len) throws IOException {
          if (off < 0 || len < 0 || (off + len) > out.length) {
              throw new IllegalArgumentException(String.format(
                      "Illegal arguments for read: byte[%d], off:%d, len:%d",
                      out.length, off, len));
          }
  
          final int end = off + len;
          int pos = off;
          int i;
          while (pos < end && (i = in.read(out, off, end - off)) >= 0) {
              pos += i;
          }
          return pos - off;
      }