Package io.grpc.internal
Class GrpcUtil.TimeoutMarshaller
java.lang.Object
io.grpc.internal.GrpcUtil.TimeoutMarshaller
- All Implemented Interfaces:
Metadata.AsciiMarshaller<Long>
- Enclosing class:
GrpcUtil
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 = hours
The representation is greedy with respect to precision. That is, 2 seconds will be represented as `2000000u`.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparseAsciiString
(String serialized) Parse a serialized metadata value from an ASCII string.toAsciiString
(Long timeoutNanos) Serialize a metadata value to a ASCII string that contains only the characters listed in the class comment ofMetadata.AsciiMarshaller
.
-
Constructor Details
-
TimeoutMarshaller
TimeoutMarshaller()
-
-
Method Details
-
toAsciiString
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<Long>
- Parameters:
timeoutNanos
- to serialize- Returns:
- serialized version of value, or null if value cannot be transmitted.
-
parseAsciiString
Description copied from interface:Metadata.AsciiMarshaller
Parse a serialized metadata value from an ASCII string.- Specified by:
parseAsciiString
in interfaceMetadata.AsciiMarshaller<Long>
- Parameters:
serialized
- value of metadata to parse- Returns:
- a parsed instance of type T
-