int (char @NotNull [] cbuf, int off, int len) { if (off < 0 || off > cbuf.length || len < 0 || off + len > cbuf.length || off + len < 0) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } int charsToCopy = Math.min(len, myLength - myCurPos); if (charsToCopy <= 0) return -1; System.arraycopy(myText, myCurPos, cbuf, off, charsToCopy); myCurPos += charsToCopy; return charsToCopy; }