Package io.grpc.internal
Class GrpcUtil.TimeoutMarshaller
- java.lang.Object
-
- io.grpc.internal.GrpcUtil.TimeoutMarshaller
-
- All Implemented Interfaces:
Metadata.AsciiMarshaller<java.lang.Long>
- Enclosing class:
- GrpcUtil
static class GrpcUtil.TimeoutMarshaller extends java.lang.Object implements Metadata.AsciiMarshaller<java.lang.Long>
Marshals a nanoseconds representation of the timeout to and from a string representation, consisting of an ASCII decimal representation of a number with at most 8 digits, followed by a unit. Available units: n = nanoseconds u = microseconds m = milliseconds S = seconds M = minutes H = hoursThe representation is greedy with respect to precision. That is, 2 seconds will be represented as `2000000u`.
-
-
Constructor Summary
Constructors Constructor Description TimeoutMarshaller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Long
parseAsciiString(java.lang.String serialized)
Parse a serialized metadata value from an ASCII string.java.lang.String
toAsciiString(java.lang.Long timeoutNanos)
Serialize a metadata value to a ASCII string that contains only the characters listed in the class comment ofMetadata.AsciiMarshaller
.
-
-
-
Method Detail
-
toAsciiString
public java.lang.String toAsciiString(java.lang.Long timeoutNanos)
Description copied from interface:Metadata.AsciiMarshaller
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.AsciiMarshaller<java.lang.Long>
- Parameters:
timeoutNanos
- to serialize- Returns:
- serialized version of value, or null if value cannot be transmitted.
-
parseAsciiString
public java.lang.Long parseAsciiString(java.lang.String serialized)
Description copied from interface:Metadata.AsciiMarshaller
Parse a serialized metadata value from an ASCII string.- Specified by:
parseAsciiString
in interfaceMetadata.AsciiMarshaller<java.lang.Long>
- Parameters:
serialized
- value of metadata to parse- Returns:
- a parsed instance of type T
-
-