Interface Writeable.Writer<V>

Enclosing interface:
Writeable
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @PublicApi(since="2.8.0") public static interface Writeable.Writer<V>
Reference to a method that can write some object to a StreamOutput.

By convention this is a method from StreamOutput itself (e.g., StreamOutput#writeString). If the value can be null, then the "optional" variant of methods should be used!

Most classes should implement Writeable and the Writeable#writeTo(StreamOutput) method should use StreamOutput methods directly or this indirectly:


 public void writeTo(StreamOutput out) throws IOException {
     out.writeVInt(someValue);
     out.writeMapOfLists(someMap, StreamOutput::writeString, StreamOutput::writeString);
 }
 
Opensearch.api:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    write(StreamOutput out, V value)
    Write V-type value to the output stream.
  • Method Details

    • write

      void write(StreamOutput out, V value) throws IOException
      Write V-type value to the output stream.
      Parameters:
      out - Output to write the value too
      value - The value to add
      Throws:
      IOException