Package io.grpc
Class Status.StatusMessageMarshaller
- java.lang.Object
-
- io.grpc.Status.StatusMessageMarshaller
-
- All Implemented Interfaces:
Metadata.TrustedAsciiMarshaller<java.lang.String>
- Enclosing class:
- Status
private static final class Status.StatusMessageMarshaller extends java.lang.Object implements Metadata.TrustedAsciiMarshaller<java.lang.String>
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
HEX
-
Constructor Summary
Constructors Modifier Constructor Description private
StatusMessageMarshaller()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static boolean
isEscapingChar(byte b)
java.lang.String
parseAsciiString(byte[] value)
Parse a serialized metadata value from an ASCII string.private static java.lang.String
parseAsciiStringSlow(byte[] value)
byte[]
toAsciiString(java.lang.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.
-
-
-
Method Detail
-
toAsciiString
public byte[] toAsciiString(java.lang.String value)
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<java.lang.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
public java.lang.String parseAsciiString(byte[] value)
Description copied from interface:Metadata.TrustedAsciiMarshaller
Parse a serialized metadata value from an ASCII string.- Specified by:
parseAsciiString
in interfaceMetadata.TrustedAsciiMarshaller<java.lang.String>
- Parameters:
value
- value of metadata to parse- Returns:
- a parsed instance of type T
-
parseAsciiStringSlow
private static java.lang.String parseAsciiStringSlow(byte[] value)
-
-