Record Class MD5

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.util.MD5

public record MD5(byte[] bytes, String string, int hash) extends Record
  • Field Details

    • NIL

      public static final MD5 NIL
    • CODEC

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

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

      public static final DataType<MD5> DATA_TYPE
  • Constructor Details

    • MD5

      public MD5(byte[] bytes, String string, int hash)
      Creates an instance of a MD5 record class.
      Parameters:
      bytes - the value for the bytes record component
      string - the value for the string record component
      hash - the value for the hash record component
  • Method Details

    • fromBytes

      public static MD5 fromBytes(byte[] bytes)
    • fromString

      public static MD5 fromString(String string)
    • read

      public static MD5 read(DataInput data) throws IOException
      Throws:
      IOException
    • of

      public static MD5 of(Path file, @Nullable @Nullable LongConsumer callback) throws IOException
      Throws:
      IOException
    • of

      public static MD5 of(FileInfo fileInfo, @Nullable @Nullable LongConsumer callback) throws IOException
      Throws:
      IOException
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • isEmpty

      public boolean isEmpty()
    • write

      public void write(DataOutput data) throws IOException
      Throws:
      IOException
    • bytes

      public byte[] bytes()
      Returns the value of the bytes record component.
      Returns:
      the value of the bytes record component
    • string

      public String string()
      Returns the value of the string record component.
      Returns:
      the value of the string record component
    • hash

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