void (byte[] b, int off, int len) { int start = off; int maxOffset = off + len; for (int i = off; i < maxOffset; i++) { if (b[i] == '\n') { myBuffer.append(new String(b, start, i - start + 1, StandardCharsets.UTF_8)); doFlush(); start = i + 1; } } if (start < maxOffset) { myBuffer.append(new String(b, start, maxOffset - start, StandardCharsets.UTF_8)); } }