- All Implemented Interfaces:
Encode,ValidMediaFilter,ValidMediaInput,ValidMediaOutput,Whitespace,NoClose,Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
JavaScriptWriter,MysqlWriter,PsqlWriter,ShWriter,StyleWriter,TextWriter,XhtmlAttributeWriter,XhtmlWriter
- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
Fields inherited from class com.aoapps.encoding.MediaWriter
DEFAULT_CLOSER, DEFAULT_IS_NO_CLOSEFields inherited from class java.io.FilterWriter
outFields inherited from interface com.aoapps.encoding.Whitespace
INDENT_SPACES, NL, SPACE -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(CharSequence csq) append(CharSequence csq, int start, int end) decDepth()Decrements the indentation depth, if enabled.Encodes the given nested type with proper encoding.Encodes the given nested type with proper encoding.Encodes the given nested type with proper encoding.<Ex extends Throwable>
WhitespaceWriterencode(MediaType contentType, MediaWritable<Ex> content) Encodes the given nested type with proper encoding.<Ex extends Throwable>
WhitespaceWriterencode(MediaType contentType, IOSupplierE<?, Ex> content) Encodes the given nested type with proper encoding.encode(MediaType contentType, CharSequence csq) Encodes the given nested type with proper encoding.encode(MediaType contentType, CharSequence csq, int start, int end) Encodes the given nested type with proper encoding.Encodes the given nested type with proper encoding.intgetDepth()Gets the current indentation depth, which begins at zero.booleanGets if indentation is currently enabled, off by default.incDepth()Increments the indentation depth, if enabled.indent()Writes the current indentation when indentation enabled.indent(int depthOffset) Writes the current indentation with a depth offset when indentation enabled.nl()Writes a newline.nli()Writes a newline, followed by current indentation when indentation enabled.nli(int depthOffset) Writes a newline, followed by current indentation with a depth offset when indentation enabled.setDepth(int depth) Sets the indentation depth.setIndent(boolean indent) Enables or disabled indentation.sp()Writes one space character.sp(int count) Writes the given number of space characters.Methods inherited from class com.aoapps.encoding.MediaWriter
canSkipValidation, close, encode, getEncoder, getEncodingContext, getValidMediaInputType, getValidMediaOutputType, isNoClose, isValidatingMediaInputTypeMethods inherited from class com.aoapps.lang.io.EncoderWriter
getOut, write, write, write, write, write, writePrefix, writeSuffix, writeSuffixMethods inherited from class java.io.FilterWriter
flushMethods inherited from class java.io.Writer
nullWriter
-
Method Details
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classMediaWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classMediaWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classMediaWriter- Throws:
IOException
-
encode
Description copied from interface:EncodeEncodes the given nested type with proper encoding.- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Returns:
thiswriter- Throws:
IOException
-
encode
Description copied from interface:EncodeEncodes the given nested type with proper encoding.- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Returns:
thiswriter- Throws:
IOException
-
encode
public WhitespaceWriter encode(MediaType contentType, char[] cbuf, int offset, int len) throws IOException Description copied from interface:EncodeEncodes the given nested type with proper encoding.- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Returns:
thiswriter- Throws:
IOException
-
encode
Description copied from interface:EncodeEncodes the given nested type with proper encoding.Adds prefixes and suffixes by media type, such as
"…".If the string is translated, comments will be added giving the translation lookup id to aid in translation of server-translated values.
- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Returns:
thiswriter- Throws:
IOException
-
encode
public WhitespaceWriter encode(MediaType contentType, CharSequence csq, int start, int end) throws IOException Description copied from interface:EncodeEncodes the given nested type with proper encoding.Adds prefixes and suffixes by media type, such as
"…".If the string is translated, comments will be added giving the translation lookup id to aid in translation of server-translated values.
- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Returns:
thiswriter- Throws:
IOException
-
encode
Description copied from interface:EncodeEncodes the given nested type with proper encoding.Adds prefixes and suffixes by media type, such as
"…".If the string is translated, comments will be added giving the translation lookup id to aid in translation of server-translated values.
- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Returns:
thiswriter- Throws:
IOException
-
encode
public <Ex extends Throwable> WhitespaceWriter encode(MediaType contentType, IOSupplierE<?, Ex> content) throws IOException, ExDescription copied from interface:EncodeEncodes the given nested type with proper encoding.Adds prefixes and suffixes by media type, such as
"…".If the string is translated, comments will be added giving the translation lookup id to aid in translation of server-translated values.
- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Type Parameters:
Ex- An arbitrary exception type that may be thrown- Returns:
thiswriter- Throws:
IOExceptionEx
-
encode
public <Ex extends Throwable> WhitespaceWriter encode(MediaType contentType, MediaWritable<Ex> content) throws IOException, Ex Description copied from interface:EncodeEncodes the given nested type with proper encoding.Adds prefixes and suffixes by media type, such as
"…".Does not perform any translation markups.
- Specified by:
encodein interfaceEncode- Overrides:
encodein classMediaWriter- Type Parameters:
Ex- An arbitrary exception type that may be thrown- Returns:
thiswriter- Throws:
IOExceptionEx
-
nl
Description copied from interface:WhitespaceWrites a newline.This is
'\n'on all platforms. If a different newline is required, such as"\r\n"for email, filter the output.- Specified by:
nlin interfaceWhitespace- Returns:
thiswriter- Throws:
IOException- See Also:
-
nli
Description copied from interface:WhitespaceWrites a newline, followed by current indentation when indentation enabled.This is
'\n'on all platforms. If a different newline is required, such as"\r\n"for email, filter the output.- Specified by:
nliin interfaceWhitespace- Returns:
thiswriter- Throws:
IOException- See Also:
-
nli
Description copied from interface:WhitespaceWrites a newline, followed by current indentation with a depth offset when indentation enabled.This is
'\n'on all platforms. If a different newline is required, such as"\r\n"for email, filter the output.- Specified by:
nliin interfaceWhitespace- Parameters:
depthOffset- A value added to the current indentation depth. For example, pass-1when performing a newline before a closing tag or ending curly brace.- Returns:
thiswriter- Throws:
IOException- See Also:
-
indent
Description copied from interface:WhitespaceWrites the current indentation when indentation enabled.- Specified by:
indentin interfaceWhitespace- Returns:
thiswriter- Throws:
IOException- See Also:
-
indent
Description copied from interface:WhitespaceWrites the current indentation with a depth offset when indentation enabled.- Specified by:
indentin interfaceWhitespace- Parameters:
depthOffset- A value added to the current indentation depth. For example, pass-1when performing a newline before a closing tag or ending curly brace.- Returns:
thiswriter- Throws:
IOException- See Also:
-
getIndent
public boolean getIndent()Description copied from interface:WhitespaceGets if indentation is currently enabled, off by default.- Specified by:
getIndentin interfaceWhitespace
-
setIndent
Description copied from interface:WhitespaceEnables or disabled indentation.- Specified by:
setIndentin interfaceWhitespace- Returns:
thiswriter
-
getDepth
public int getDepth()Description copied from interface:WhitespaceGets the current indentation depth, which begins at zero. This value is not updated when indentation is disabled. Not all tags will trigger indentation.- Specified by:
getDepthin interfaceWhitespace
-
setDepth
Description copied from interface:WhitespaceSets the indentation depth.- Specified by:
setDepthin interfaceWhitespace- Returns:
thiswriter
-
incDepth
Description copied from interface:WhitespaceIncrements the indentation depth, if enabled.- Specified by:
incDepthin interfaceWhitespace- Returns:
thiswriter
-
decDepth
Description copied from interface:WhitespaceDecrements the indentation depth, if enabled.- Specified by:
decDepthin interfaceWhitespace- Returns:
thiswriter
-
sp
Description copied from interface:WhitespaceWrites one space character.- Specified by:
spin interfaceWhitespace- Returns:
thiswriter- Throws:
IOException- See Also:
-
sp
Description copied from interface:WhitespaceWrites the given number of space characters.- Specified by:
spin interfaceWhitespace- Parameters:
count- Whencount <= 0, nothing is written.- Returns:
thiswriter- Throws:
IOException- See Also:
-
