public static OutputStream quoteOutputStream ( final OutputStream out ) throws IOException { return new OutputStream ( ) { private byte [ ] data = new byte [ 1 ] ; @ Override public void write ( byte [ ] data , int off , int len ) throws IOException { quoteHtmlChars ( out , data , off , len ) ; } @ Override public void write ( int b ) throws IOException { data [ 0 ] = ( byte ) b ; quoteHtmlChars ( out , data , 0 , 1 ) ; } @ Override public void flush ( ) throws IOException { out . flush ( ) ; } @ Override public void close ( ) throws IOException { out . close ( ) ; } } ; }
Return an output stream that quotes all of the output .