Class EitherType<T,V>

java.lang.Object
com.viaversion.viaversion.api.type.Type<Either<T,V>>
com.viaversion.viaversion.api.type.types.EitherType<T,V>
All Implemented Interfaces:
ByteBufReader<Either<T,V>>, ByteBufWriter<Either<T,V>>

public final class EitherType<T,V> extends Type<Either<T,V>>
  • Constructor Details

    • EitherType

      public EitherType(Type<T> leftType, Type<V> rightType)
  • Method Details

    • read

      public Either<T,V> read(io.netty.buffer.ByteBuf buffer)
      Description copied from interface: ByteBufReader
      Reads a value from a ByteBuf.
      Parameters:
      buffer - buffer to read from
      Returns:
      type based on the class type
    • write

      public void write(io.netty.buffer.ByteBuf buffer, Either<T,V> value)
      Description copied from interface: ByteBufWriter
      Writes an object to a type to a ByteBuf.
      Parameters:
      buffer - buffer to write to
      value - value to write
    • read

      public static <X, Y> Either<X,Y> read(io.netty.buffer.ByteBuf buf, Type<X> leftType, Type<Y> rightType)
    • write

      public static <X, Y> void write(io.netty.buffer.ByteBuf buf, Either<X,Y> value, Type<X> leftType, Type<Y> rightType)