Record Class CRC32

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.io.checksum.CRC32
All Implemented Interfaces:
Checksum

public record CRC32(int a) extends Record implements Checksum
  • Field Details

    • NIL

      public static final CRC32 NIL
    • TYPE

      public static final ChecksumType<CRC32> TYPE
    • CODEC

      public static final com.mojang.serialization.Codec<CRC32> CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,CRC32> STREAM_CODEC
    • DATA_TYPE

      public static final DataType<CRC32> DATA_TYPE
  • Constructor Details

    • CRC32

      public CRC32(int a)
      Creates an instance of a CRC32 record class.
      Parameters:
      a - the value for the a record component
  • Method Details

    • of

      public static CRC32 of(int a)
    • of

      public static CRC32 of(byte[] bytes)
    • type

      public ChecksumType<CRC32> type()
      Specified by:
      type in interface Checksum
    • toString

      @NotNull public @NotNull 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 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 boolean equals(Object obj)
      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 '=='.
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • isNil

      public boolean isNil()
      Specified by:
      isNil in interface Checksum
    • toByteArray

      public byte[] toByteArray()
      Specified by:
      toByteArray in interface Checksum
    • write

      public void write(ByteOutput data) throws IOException
      Specified by:
      write in interface Checksum
      Throws:
      IOException
    • encode

      public void encode(io.netty.buffer.ByteBuf buf)
      Specified by:
      encode in interface Checksum
    • a

      public int a()
      Returns the value of the a record component.
      Returns:
      the value of the a record component