Class TextFormatEscaper


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

      Constructors 
      Modifier Constructor Description
      private TextFormatEscaper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static java.lang.String escapeBytes​(byte[] input)
      Like escapeBytes(ByteString), but used for byte array.
      (package private) static java.lang.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.
      (package private) static java.lang.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.
      (package private) static java.lang.String escapeDoubleQuotesAndBackslashes​(java.lang.String input)
      Escape double quotes and backslashes in a String for unicode output of a message.
      (package private) static java.lang.String escapeText​(java.lang.String input)
      Like escapeBytes(ByteString), but escapes a text string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextFormatEscaper

        private TextFormatEscaper()
    • Method Detail

      • escapeBytes

        static java.lang.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 java.lang.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 java.lang.String escapeBytes​(byte[] input)
        Like escapeBytes(ByteString), but used for byte array.
      • escapeText

        static java.lang.String escapeText​(java.lang.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 java.lang.String escapeDoubleQuotesAndBackslashes​(java.lang.String input)
        Escape double quotes and backslashes in a String for unicode output of a message.