docs: public static int readn ( InputStream in, byte[] b, int off, int len ) throws IOException {
          int i = 0, n = -5;
  
          if ( off + len > b.length ) {
              throw new IOException("Buffer too short, bufsize " + b.length + " read " + len);
          }
  
          while ( i < len ) {
              n = in.read(b, off + i, len - i);
              if ( n <= 0 ) {
                  break;
              }
              i += n;
          }
  
          return i;
      }