@Override public int read(CharBuffer target) throws IOException { if (hasReachedLimit()) throw new ByteLimitExceededException("byte limit exceeded", byteLimit); int charsRead = reader.read(target); if (charsRead != -1) byteCount += charsRead; return charsRead; }
@Override public int read() throws IOException { if (hasReachedLimit()) throw new ByteLimitExceededException("byte limit exceeded", byteLimit); int value = reader.read(); byteCount++; return value; }
@Override public int read(char[] cbuf) throws IOException { if (hasReachedLimit()) throw new ByteLimitExceededException("byte limit exceeded", byteLimit); int charsRead = reader.read(cbuf); if (charsRead != -1) byteCount += charsRead; return charsRead; }
@Override public int read(char[] cbuf, int off, int len) throws IOException { if (hasReachedLimit()) throw new ByteLimitExceededException("byte limit exceeded", byteLimit); int charsRead = reader.read(cbuf, off, len); if (charsRead != -1) byteCount += charsRead; return charsRead; }