Interface Readable.Reader<V>

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

    @FunctionalInterface
    public static interface Readable.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);
     }