private static BufferedWriter bufferOutput ( Writer writer ) { BufferedWriter out ; if ( writer instanceof BufferedWriter ) { out = ( BufferedWriter ) writer ; } else { out = new BufferedWriter ( writer ) ; } return out ; }
Wraps the Writer in a BufferedWriter unless it already is a BufferedWriter .