Interface Text

All Superinterfaces:
Encode
All Known Implementing Classes:
JavaScriptWriter, JsonWriter, LdJsonWriter, MysqlWriter, PsqlWriter, ShWriter, StyleWriter, TextWriter, XhtmlAttributeWriter, XhtmlWriter

@ThreadSafe public interface Text extends Encode
Encodes arbitrary text for safe output.
Author:
AO Industries, Inc.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final char
    The character used for non-breaking space, which is '\\u00A0'.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Text
    encode(MediaType contentType, char ch)
    Encodes the given nested type with proper encoding.
    default Text
    encode(MediaType contentType, char[] cbuf)
    Encodes the given nested type with proper encoding.
    default Text
    encode(MediaType contentType, char[] cbuf, int offset, int len)
    Encodes the given nested type with proper encoding.
    default <Ex extends Throwable>
    Text
    encode(MediaType contentType, MediaWritable<Ex> content)
    Encodes the given nested type with proper encoding.
    default <Ex extends Throwable>
    Text
    encode(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.
    encode(MediaType contentType, Object content)
    Encodes the given nested type with proper encoding.
    default Text
    Writes one non-breaking space character.
    default Text
    nbsp(int count)
    Writes the given number of non-breaking space characters.
    default TextWriter
    Writes the given text with proper encoding.
    default Text
    text(char ch)
    Writes the given text with proper encoding.
    default Text
    text(char[] cbuf)
    Writes the given text with proper encoding.
    default Text
    text(char[] cbuf, int offset, int len)
    Writes the given text with proper encoding.
    default <Ex extends Throwable>
    Text
    text(TextWritable<Ex> text)
    Writes the given text with proper encoding.
    default <Ex extends Throwable>
    Text
    text(IOSupplierE<?,Ex> text)
    Writes the given text with proper encoding.
    default Text
    Writes the given text with proper encoding.
    default Text
    text(CharSequence csq, int start, int end)
    Writes the given text with proper encoding.
    default Text
    text(Object text)
    Writes the given text with proper encoding.

    Methods inherited from interface com.aoapps.encoding.Encode

    encode
  • Field Details

    • NBSP

      static final char NBSP
      The character used for non-breaking space, which is '\\u00A0'.
      See Also:
  • Method Details

    • encode

      default Text encode(MediaType contentType, char ch) throws IOException
      Description copied from interface: Encode
      Encodes the given nested type with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Specified by:
      encode in interface Encode
      Returns:
      this writer
      Throws:
      IOException
    • encode

      default Text encode(MediaType contentType, char[] cbuf) throws IOException
      Description copied from interface: Encode
      Encodes the given nested type with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Specified by:
      encode in interface Encode
      Returns:
      this writer
      Throws:
      IOException
    • encode

      default Text encode(MediaType contentType, char[] cbuf, int offset, int len) throws IOException
      Description copied from interface: Encode
      Encodes the given nested type with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Specified by:
      encode in interface Encode
      Returns:
      this writer
      Throws:
      IOException
    • encode

      Text encode(MediaType contentType, CharSequence csq) throws IOException
      Description copied from interface: Encode
      Encodes 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:
      encode in interface Encode
      Returns:
      this writer
      Throws:
      IOException
    • encode

      Text encode(MediaType contentType, CharSequence csq, int start, int end) throws IOException
      Description copied from interface: Encode
      Encodes 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:
      encode in interface Encode
      Returns:
      this writer
      Throws:
      IOException
    • encode

      Text encode(MediaType contentType, Object content) throws IOException
      Description copied from interface: Encode
      Encodes 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:
      encode in interface Encode
      Returns:
      this writer
      Throws:
      IOException
    • encode

      default <Ex extends Throwable> Text encode(MediaType contentType, IOSupplierE<?,Ex> content) throws IOException, Ex
      Description copied from interface: Encode
      Encodes 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:
      encode in interface Encode
      Type Parameters:
      Ex - An arbitrary exception type that may be thrown
      Returns:
      this writer
      Throws:
      IOException
      Ex
    • encode

      default <Ex extends Throwable> Text encode(MediaType contentType, MediaWritable<Ex> content) throws IOException, Ex
      Description copied from interface: Encode
      Encodes the given nested type with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Does not perform any translation markups.

      Specified by:
      encode in interface Encode
      Type Parameters:
      Ex - An arbitrary exception type that may be thrown
      Returns:
      this writer
      Throws:
      IOException
      Ex
    • nbsp

      default Text nbsp() throws IOException
      Writes one non-breaking space character.

      Adds prefixes and suffixes by media type, such as "…".

      Returns:
      this writer
      Throws:
      IOException
      See Also:
    • nbsp

      default Text nbsp(int count) throws IOException
      Writes the given number of non-breaking space characters.

      Adds prefixes and suffixes by media type, such as "…".

      Parameters:
      count - When count <= 0, nothing is written.
      Returns:
      this writer
      Throws:
      IOException
      See Also:
    • text

      default Text text(char ch) throws IOException
      Writes the given text with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Returns:
      this writer
      Throws:
      IOException
    • text

      default Text text(char[] cbuf) throws IOException
      Writes the given text with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Returns:
      this writer
      Throws:
      IOException
    • text

      default Text text(char[] cbuf, int offset, int len) throws IOException
      Writes the given text with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Returns:
      this writer
      Throws:
      IOException
    • text

      default Text text(CharSequence csq) throws IOException
      Writes the given text 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.

      Returns:
      this writer
      Throws:
      IOException
    • text

      default Text text(CharSequence csq, int start, int end) throws IOException
      Writes the given text 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.

      Returns:
      this writer
      Throws:
      IOException
    • text

      default Text text(Object text) throws IOException
      Writes the given text 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.

      Returns:
      this writer
      Throws:
      IOException
    • text

      default <Ex extends Throwable> Text text(IOSupplierE<?,Ex> text) throws IOException, Ex
      Writes the given text 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.

      Type Parameters:
      Ex - An arbitrary exception type that may be thrown
      Returns:
      this writer
      Throws:
      IOException
      Ex
    • text

      default <Ex extends Throwable> Text text(TextWritable<Ex> text) throws IOException, Ex
      Writes the given text with proper encoding.

      Adds prefixes and suffixes by media type, such as "…".

      Does not perform any translation markups.

      Type Parameters:
      Ex - An arbitrary exception type that may be thrown
      Returns:
      this writer
      Throws:
      IOException
      Ex
    • text

      default TextWriter text() throws IOException
      Writes the given text with proper encoding. This is well suited for use in a try-with-resources block.

      Adds prefixes and suffixes by media type, such as "…".

      Does not perform any translation markups.

      Returns:
      A new writer that may be used for arbitrary text. This writer must be closed for completed calls to MediaEncoder.writeSuffixTo(java.lang.Appendable, boolean).
      Throws:
      IOException