Class EncodedWriter

java.lang.Object
java.io.Writer
org.owasp.encoder.EncodedWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class EncodedWriter extends Writer
EncodedWriter -- A writer that encodes all input for a specific context and writes the encoded output to another writer.
Author:
Jeff Ichnowski
  • Constructor Details

    • EncodedWriter

      public EncodedWriter(Writer out, Encoder encoder)
      Creates an EncodedWriter that uses the specified encoder to encode all input before sending it to the wrapped writer.
      Parameters:
      out - the target for all writes
      encoder - the encoder to use
    • EncodedWriter

      public EncodedWriter(Writer out, String contextName) throws UnsupportedContextException
      Creates an EncodedWriter that uses the specified encoder to encode all input before sending it to the wrapped writer. This method is equivalent to calling:
           new EncodedWriter(out, Encoders.forName(contextName));
       
      Parameters:
      out - the target for all writes
      contextName - the encoding context name.
      Throws:
      UnsupportedContextException - if the contextName is unrecognized or not supported.
  • Method Details