code: public void write(final int cc) throws IOException {
      final byte c = (byte) cc;
      if ((c == '\n') || (c == '\r')) {
        // new line is started in case of
        // - CR (regardless of previous character)
        // - LF if previous character was not CR and not LF
        if (c == '\r' || (c == '\n' && (lastReceivedByte != '\r' && lastReceivedByte != '\n'))) {
          processBuffer();
        }
      } else {
        buffer.write(cc);
      }
      lastReceivedByte = c;
    }
docs: Write the data to the buffer and flush the buffer, if a line separator is
  detected.
  
  @param cc data to log (byte).
  @see java.io.OutputStream#write(int)