-
public interface EncoderEncodes data as it is written to the provided output.- Author:
- AO Industries, Inc.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Encoderappend(char c, Appendable out)Encoderappend(CharSequence csq, int start, int end, Appendable out)Encoderappend(CharSequence csq, Appendable out)default booleanisBuffered()Is this encoder buffered? A buffered encoder may delay validation untilwriteSuffixTo(java.lang.Appendable, boolean).voidwrite(char[] cbuf, int off, int len, Writer out)voidwrite(char[] cbuf, Writer out)voidwrite(int c, Writer out)voidwrite(String str, int off, int len, Writer out)voidwrite(String str, Writer out)voidwritePrefixTo(Appendable out)This is called before any data is written.voidwriteSuffixTo(Appendable out)Deprecated.Please usewriteSuffixTo(java.lang.Appendable, boolean)while specifying desired trim.default voidwriteSuffixTo(Appendable out, boolean trim)This is called when no more data will be written.
-
-
-
Method Detail
-
isBuffered
default boolean isBuffered()
Is this encoder buffered? A buffered encoder may delay validation untilwriteSuffixTo(java.lang.Appendable, boolean). Furthermore, a buffered encoder should not be bypassed before any buffered data has been written viawriteSuffixTo(java.lang.Appendable, boolean). An example of encoder bypassing is performing direct output on the writer fromEncoderWriter.getOut().- Returns:
falseby default
-
writePrefixTo
void writePrefixTo(Appendable out) throws IOException
This is called before any data is written.- Parameters:
out- May optionally have already been optimized viaCoercion.optimize(java.lang.Appendable, com.aoapps.lang.io.Encoder).- Throws:
IOException
-
write
void write(int c, Writer out) throws IOException- Throws:
IOException
-
write
void write(char[] cbuf, Writer out) throws IOException- Throws:
IOException
-
write
void write(char[] cbuf, int off, int len, Writer out) throws IOException- Throws:
IOException
-
write
void write(String str, Writer out) throws IOException
- Throws:
IOException
-
write
void write(String str, int off, int len, Writer out) throws IOException
- Throws:
IOException
-
append
Encoder append(char c, Appendable out) throws IOException
- Throws:
IOException
-
append
Encoder append(CharSequence csq, Appendable out) throws IOException
- Throws:
IOException
-
append
Encoder append(CharSequence csq, int start, int end, Appendable out) throws IOException
- Throws:
IOException
-
writeSuffixTo
@Deprecated void writeSuffixTo(Appendable out) throws IOException
Deprecated.Please usewriteSuffixTo(java.lang.Appendable, boolean)while specifying desired trim.This is called when no more data will be written. This should also flush any internal buffers toout. It should not, however, call flush onoutitself. This is to not interfere with any output buffering ofout.The internal buffer is always clear for re-use, even when an exception is thrown.
- Parameters:
out- May optionally have already been optimized viaCoercion.optimize(java.lang.Appendable, com.aoapps.lang.io.Encoder).- Throws:
IOException
-
writeSuffixTo
default void writeSuffixTo(Appendable out, boolean trim) throws IOException
This is called when no more data will be written. This should also flush any internal buffers toout. It should not, however, call flush onoutitself. This is to not interfere with any output buffering ofout.The internal buffer is always clear for re-use, even when an exception is thrown.
- Parameters:
out- May optionally have already been optimized viaCoercion.optimize(java.lang.Appendable, com.aoapps.lang.io.Encoder).trim- Requests that the buffer be trimmed, if buffered and trim supported.- Throws:
IOException
-
-