Package io.grpc
Class Status.StatusMessageMarshaller
java.lang.Object
io.grpc.Status.StatusMessageMarshaller
- All Implemented Interfaces:
Metadata.TrustedAsciiMarshaller<String>
- Enclosing class:
Status
private static final class Status.StatusMessageMarshaller
extends Object
implements Metadata.TrustedAsciiMarshaller<String>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
isEscapingChar
(byte b) parseAsciiString
(byte[] value) Parse a serialized metadata value from an ASCII string.private static String
parseAsciiStringSlow
(byte[] value) byte[]
toAsciiString
(String value) Serialize a metadata value to a ASCII string that contains only the characters listed in the class comment ofMetadata.AsciiMarshaller
.private static byte[]
toAsciiStringSlow
(byte[] valueBytes, int ri) Percent encode bytes to make them ASCII.
-
Field Details
-
HEX
private static final byte[] HEX
-
-
Constructor Details
-
StatusMessageMarshaller
private StatusMessageMarshaller()
-
-
Method Details
-
toAsciiString
Description copied from interface:Metadata.TrustedAsciiMarshaller
Serialize a metadata value to a ASCII string that contains only the characters listed in the class comment ofMetadata.AsciiMarshaller
. Otherwise the output may be considered invalid and discarded by the transport, or the call may fail.- Specified by:
toAsciiString
in interfaceMetadata.TrustedAsciiMarshaller<String>
- Parameters:
value
- to serialize- Returns:
- serialized version of value, or null if value cannot be transmitted.
-
isEscapingChar
private static boolean isEscapingChar(byte b) -
toAsciiStringSlow
private static byte[] toAsciiStringSlow(byte[] valueBytes, int ri) Percent encode bytes to make them ASCII.- Parameters:
valueBytes
- the UTF-8 bytesri
- The reader index, pointed at the first byte that needs escaping.
-
parseAsciiString
Description copied from interface:Metadata.TrustedAsciiMarshaller
Parse a serialized metadata value from an ASCII string.- Specified by:
parseAsciiString
in interfaceMetadata.TrustedAsciiMarshaller<String>
- Parameters:
value
- value of metadata to parse- Returns:
- a parsed instance of type T
-
parseAsciiStringSlow
-