in commons-geometry-io-core/src/main/java/org/apache/commons/geometry/io/core/internal/CharReadBuffer.java [334:361]
private void readChars(final int n) {
if (!reachedEof) {
int remaining = Math.max(n, minRead);
ensureCapacity(count + remaining);
try {
int tail;
int len;
int read;
while (remaining > 0) {
tail = (head + count) % buffer.length;
len = Math.min(buffer.length - tail, remaining);
read = reader.read(buffer, tail, len);
if (read == EOF) {
reachedEof = true;
break;
}
charsAppended(read);
remaining -= read;
}
} catch (IOException exc) {
throw GeometryIOUtils.createUnchecked(exc);
}
}
}