text: public int read(CharBuffer target) throws IOException {int remaining = remaining();if (target == this) {if (remaining == 0) {return -1;}throw new IllegalArgumentException();}if (remaining == 0) {return limit > 0 && target.remaining() == 0 ? 0 : -1;}remaining = Math.min(target.remaining(), remaining);if (remaining > 0) {char[] chars = new char[remaining];get(chars);target.put(chars);}return remaining;}