Interface Pipe.Encoder<T>

Enclosing interface:
Pipe
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 Pipe.Encoder<T>
Support for efficiently writing complex objects to a pipe.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    encode(T object, int length, byte[] buffer, int offset)
    Called to encode an object.
    default void
    encode(T object, int length, Pipe pipe)
    Called to encode an object when the requested length was too large.
  • Method Details

    • encode

      int encode(T object, int length, byte[] buffer, int offset) throws IOException
      Called to encode an object.
      Parameters:
      object - object which was passed to the writeEncode method
      length - requested buffer length
      buffer - buffer to encode into
      offset - buffer offset to start writing into
      Returns:
      the updated offset
      Throws:
      IOException
    • encode

      default void encode(T object, int length, Pipe pipe) throws IOException
      Called to encode an object when the requested length was too large. By default, a temporary buffer is allocated and then the regular encode method is called.
      Parameters:
      object - object which was passed to the writeEncode method
      length - requested buffer length
      pipe - pipe to write to
      Throws:
      IOException