Class TextFormatEscaper

java.lang.Object
com.google.protobuf.TextFormatEscaper

final class TextFormatEscaper extends Object
Provide text format escaping support for proto2 instances.
  • Constructor Details

    • TextFormatEscaper

      private TextFormatEscaper()
  • Method Details

    • escapeBytes

      static String escapeBytes(TextFormatEscaper.ByteSequence input)
      Escapes bytes in the format used in protocol buffer text format, which is the same as the format used for C string literals. All bytes that are not printable 7-bit ASCII characters are escaped, as well as backslash, single-quote, and double-quote characters. Characters for which no defined short-hand escape sequence is defined will be escaped using 3-digit octal sequences.
    • escapeBytes

      static String escapeBytes(ByteString input)
      Escapes bytes in the format used in protocol buffer text format, which is the same as the format used for C string literals. All bytes that are not printable 7-bit ASCII characters are escaped, as well as backslash, single-quote, and double-quote characters. Characters for which no defined short-hand escape sequence is defined will be escaped using 3-digit octal sequences.
    • escapeBytes

      static String escapeBytes(byte[] input)
      Like escapeBytes(ByteString), but used for byte array.
    • escapeText

      static String escapeText(String input)
      Like escapeBytes(ByteString), but escapes a text string. Non-ASCII characters are first encoded as UTF-8, then each byte is escaped individually as a 3-digit octal escape. Yes, it's weird.
    • escapeDoubleQuotesAndBackslashes

      static String escapeDoubleQuotesAndBackslashes(String input)
      Escape double quotes and backslashes in a String for unicode output of a message.