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.Writer
EncodedWriter -- 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 void
close()
void
flush()
void
write(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 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 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:
write
in classjava.io.Writer
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in classjava.io.Writer
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Writer
- Throws:
java.io.IOException
-
-