Interface Writeable.Reader<V>

All Known Subinterfaces:
TransportResponseHandler<T>
All Known Implementing Classes:
ActionListenerResponseHandler, EmptyTransportResponseHandler, FutureTransportResponseHandler, PlainTransportFuture, TransportService.ContextRestoreResponseHandler
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
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);
 }
 
  • Method Summary

    Modifier and Type Method Description
    V read​(StreamInput in)
    Read V-type value from a stream.
  • Method Details

    • read

      V read​(StreamInput in) throws java.io.IOException
      Read V-type value from a stream.
      Parameters:
      in - Input to read the value from
      Throws:
      java.io.IOException