Class 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 = hours

    The representation is greedy with respect to precision. That is, 2 seconds will be represented as `2000000u`.

    See the request header definition

    • 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 of Metadata.AsciiMarshaller.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeoutMarshaller

        TimeoutMarshaller()
    • 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 of Metadata.AsciiMarshaller. Otherwise the output may be considered invalid and discarded by the transport, or the call may fail.
        Specified by:
        toAsciiString in interface Metadata.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 interface Metadata.AsciiMarshaller<java.lang.Long>
        Parameters:
        serialized - value of metadata to parse
        Returns:
        a parsed instance of type T