Record Class ByteBufMessageBuffer

java.lang.Object
java.lang.Record
org.geysermc.geyser.network.message.ByteBufMessageBuffer
All Implemented Interfaces:
org.geysermc.geyser.api.network.message.MessageBuffer, org.geysermc.geyser.api.network.message.MessageBuffer.Wrapped<io.netty.buffer.ByteBuf>

public record ByteBufMessageBuffer(org.geysermc.geyser.api.network.message.MessageCodec<ByteBufMessageBuffer> codec, io.netty.buffer.ByteBuf buffer) extends Record implements org.geysermc.geyser.api.network.message.MessageBuffer.Wrapped<io.netty.buffer.ByteBuf>
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.geysermc.geyser.api.network.message.MessageBuffer

    org.geysermc.geyser.api.network.message.MessageBuffer.Wrapped<T>
  • Constructor Summary

    Constructors
    Constructor
    Description
    ByteBufMessageBuffer(org.geysermc.geyser.api.network.message.MessageCodec<ByteBufMessageBuffer> codec)
     
    ByteBufMessageBuffer(org.geysermc.geyser.api.network.message.MessageCodec<ByteBufMessageBuffer> codec, io.netty.buffer.ByteBuf buffer)
    Creates an instance of a ByteBufMessageBuffer record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    io.netty.buffer.ByteBuf
    Returns the value of the buffer record component.
    org.geysermc.geyser.api.network.message.MessageCodec<ByteBufMessageBuffer>
    Returns the value of the codec record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
     
    <T> @NonNull T
    read(@NonNull org.geysermc.geyser.api.network.message.DataType<T> type)
     
    byte @NonNull []
     
    final String
    Returns a string representation of this record class.
    <T> void
    write(@NonNull org.geysermc.geyser.api.network.message.DataType<T> type, @NonNull T value)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ByteBufMessageBuffer

      public ByteBufMessageBuffer(org.geysermc.geyser.api.network.message.MessageCodec<ByteBufMessageBuffer> codec)
    • ByteBufMessageBuffer

      public ByteBufMessageBuffer(org.geysermc.geyser.api.network.message.MessageCodec<ByteBufMessageBuffer> codec, io.netty.buffer.ByteBuf buffer)
      Creates an instance of a ByteBufMessageBuffer record class.
      Parameters:
      codec - the value for the codec record component
      buffer - the value for the buffer record component
  • Method Details

    • read

      public <T> @NonNull T read(@NonNull org.geysermc.geyser.api.network.message.DataType<T> type)
      Specified by:
      read in interface org.geysermc.geyser.api.network.message.MessageBuffer
    • write

      public <T> void write(@NonNull org.geysermc.geyser.api.network.message.DataType<T> type, @NonNull T value)
      Specified by:
      write in interface org.geysermc.geyser.api.network.message.MessageBuffer
    • serialize

      public byte @NonNull [] serialize()
      Specified by:
      serialize in interface org.geysermc.geyser.api.network.message.MessageBuffer
    • length

      public int length()
      Specified by:
      length in interface org.geysermc.geyser.api.network.message.MessageBuffer
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • codec

      public org.geysermc.geyser.api.network.message.MessageCodec<ByteBufMessageBuffer> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component
    • buffer

      public io.netty.buffer.ByteBuf buffer()
      Returns the value of the buffer record component.
      Specified by:
      buffer in interface org.geysermc.geyser.api.network.message.MessageBuffer.Wrapped<io.netty.buffer.ByteBuf>
      Returns:
      the value of the buffer record component