Class TextFormatEscaper


  • final class TextFormatEscaper
    extends java.lang.Object
    Provide text format escaping of proto instances. These ASCII characters are escaped: ASCII #7 (bell) --> \a ASCII #8 (backspace) --> \b ASCII #9 (horizontal tab) --> \t ASCII #10 (linefeed) --> \n ASCII #11 (vertical tab) --> \v ASCII #13 (carriage return) --> \r ASCII #12 (formfeed) --> \f ASCII #34 (apostrophe) --> \' ASCII #39 (straight double quote) --> \" ASCII #92 (backslash) --> \\ Other printable ASCII characters between 32 and 127 inclusive are output as is, unescaped. Other ASCII characters less than 32 and all Unicode characters 128 or greater are first encoded as UTF-8, then each byte is escaped individually as a 3-digit octal escape.
    • 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)
      Backslash escapes bytes in the format used in protocol buffer text format.
      (package private) static java.lang.String escapeBytes​(TextFormatEscaper.ByteSequence input)
      Backslash escapes bytes in the format used in protocol buffer text format.
      (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)
        Backslash escapes bytes in the format used in protocol buffer text format.
      • escapeBytes

        static java.lang.String escapeBytes​(ByteString input)
        Backslash escapes bytes in the format used in protocol buffer text format.
      • 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.
      • escapeDoubleQuotesAndBackslashes

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