Package io.grpc

Interface Metadata.AsciiMarshaller<T>

  • Enclosing class:
    Metadata

    public static interface Metadata.AsciiMarshaller<T>
    Marshaller for metadata values that are serialized into ASCII strings. The strings contain only following characters:
    • Space: 0x20, but must not be at the beginning or at the end of the value. Leading or trailing whitespace may not be preserved.
    • ASCII visible characters (0x21-0x7E).

    Note this has to be the subset of valid characters in field-content from RFC 7230 Section 3.2.

    • Method Detail

      • toAsciiString

        String toAsciiString​(T value)
        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.
        Parameters:
        value - to serialize
        Returns:
        serialized version of value, or null if value cannot be transmitted.
      • parseAsciiString

        T parseAsciiString​(String serialized)
        Parse a serialized metadata value from an ASCII string.
        Parameters:
        serialized - value of metadata to parse
        Returns:
        a parsed instance of type T