/** * Purposely flushes the stream, but doesn't close anything since the logger * is managed by another class. * * @throws IOException if an IO error occurs * @see java.io.OutputStream#close() */ public void close() throws IOException { flush(); }
/** * Flushes this output stream, writing any buffered content to the log * * @throws IOException on error * @see java.io.OutputStream#flush() */ public void flush() throws IOException { final byte[] content = bos.toByteArray(); logMessage( new String( content ) ); bos.reset(); }
/** * Writes a byte to the internal buffer. If a newline character is * encountered, then the buffer is sent to the logger. * * @param b character to write * @throws IOException if an error occurs * @see java.io.OutputStream#write(int) */ public void write( int b ) throws IOException { if ( b == '\n' ) { final byte[] content = bos.toByteArray(); logMessage( new String( content ) ); bos.reset(); return; } bos.write( b ); }