Package com.google.protobuf
Class TextFormatEscaper
- java.lang.Object
-
- com.google.protobuf.TextFormatEscaper
-
final class TextFormatEscaper extends java.lang.ObjectProvide 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) --> \\
- ASCII characters besides those three which are in the range [32..127] inclusive are output as is, unescaped.
- All other bytes are escaped as octal sequences. If we are printing text, we convert to UTF-8 and print any high codepoints as their UTF-8 encoded units in octal escapes.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTextFormatEscaper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.StringescapeBytes(byte[] input)Backslash escapes bytes in the format used in protocol buffer text format.(package private) static java.lang.StringescapeBytes(ByteString input)Backslash escapes bytes in the format used in protocol buffer text format.(package private) static java.lang.StringescapeDoubleQuotesAndBackslashes(java.lang.String input)Escape double quotes and backslashes in a String for unicode output of a message.(package private) static java.lang.StringescapeText(java.lang.String input)LikeescapeBytes(ByteString), but escapes a text string.(package private) static booleanneedsEscape(char c)
-
-
-
Method Detail
-
escapeBytes
static java.lang.String escapeBytes(byte[] 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.
-
needsEscape
static boolean needsEscape(char c)
-
escapeText
static java.lang.String escapeText(java.lang.String input)
LikeescapeBytes(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.
-
-