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();
      }
    };
  }
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.
@param out the stream to write the quoted output to
@return a new stream that the application show write to
@throws IOException if the underlying output fails