Package org.owasp.encoder
Class EncodedWriter
- java.lang.Object
-
- java.io.Writer
-
- org.owasp.encoder.EncodedWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class EncodedWriter extends java.io.WriterEncodedWriter -- A writer the encodes all input for a specific context and writes the encoded output to another writer.
-
-
Constructor Summary
Constructors Constructor Description EncodedWriter(java.io.Writer out, java.lang.String contextName)Creates an EncodedWriter that uses the specified encoder to encode all input before sending it to the wrapped writer.EncodedWriter(java.io.Writer out, Encoder encoder)Creates an EncodedWriter that uses the specified encoder to encode all input before sending it to the wrapped writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(char[] cbuf, int off, int len)
-
-
-
Constructor Detail
-
EncodedWriter
public EncodedWriter(java.io.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 writesencoder- the encoder to use
-
EncodedWriter
public EncodedWriter(java.io.Writer out, java.lang.String contextName) throws UnsupportedContextExceptionCreates 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 writescontextName- the encoding context name.- Throws:
UnsupportedContextException- if the contextName is unrecognized or not supported.
-
-
Method Detail
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
writein classjava.io.Writer- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- Throws:
java.io.IOException
-
-