@ Override public void write ( int b ) throws IOException { byte [ ] bytes = new byte [ 1 ] ; bytes [ 0 ] = ( byte ) ( b & 0xff ) ; buffer = buffer + new String ( bytes ) ; if ( buffer . endsWith ( "\n" ) ) { buffer = buffer . substring ( 0 , buffer . length ( ) - 1 ) ; flush ( ) ; } }
Writes a byte to the output stream . This method flushes automatically at the end of a line .