/** * Flush this log stream. * * @see java.io.OutputStream#flush() */ @Override public void flush() { if (buffer.size() > 0) { processBuffer(); } }
/** * Writes all remaining data from the buffer. * * @see java.io.OutputStream#close() */ @Override public void close() throws IOException { if (buffer.size() > 0) { processBuffer(); } super.close(); }
/** * 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) */ @Override public void write(final int cc) throws IOException { final byte c = (byte) cc; if (c == '\n' || c == '\r') { if (!skip) { processBuffer(); } } else { buffer.write(cc); } skip = c == '\r'; }