Interface Writeable.Reader<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.Reader<V>
Reference to a method that can read some object from a stream. By convention this is a constructor that takes StreamInput as an argument for most classes and a static method for things like enums. Returning null from one of these is always wrong - for that we use methods like StreamInput#readOptionalWriteable(Reader).

As most classes will implement this via a constructor (or a static method in the case of enumerations), it's something that should look like:


 public MyClass(final StreamInput in) throws IOException {
     this.someValue = in.readVInt();
     this.someMap = in.readMapOfLists(StreamInput::readString, StreamInput::readString);
 }
 
Opensearch.api:
  • Method Summary

    Modifier and Type
    Method
    Description
    Read V-type value from a stream.