Record Class MD5

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

public record MD5(long most, long least) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<MD5>
     
    static final DataType<MD5>
     
    static final MD5
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,MD5>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    MD5(long most, long least)
    Creates an instance of a MD5 record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static MD5
    digest(byte[] input)
     
    boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns a hash code value for this object.
    boolean
     
    long
    Returns the value of the least record component.
    long
    Returns the value of the most record component.
    static MD5
    of(byte[] bytes)
     
    static MD5
    of(long most, long least)
     
    static MD5
    of(FileInfo fileInfo, @Nullable LongConsumer callback)
     
    static MD5
    of(String string)
     
    static MD5
    of(Path file, @Nullable LongConsumer callback)
     
    static MD5
     
    byte[]
     
    @NotNull String
    Returns a string representation of this record class.
    void
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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(long most, long least)
      Creates an instance of a MD5 record class.
      Parameters:
      most - the value for the most record component
      least - the value for the least record component
  • Method Details

    • of

      public static MD5 of(long most, long least)
    • of

      public static MD5 of(byte[] bytes)
    • of

      public static MD5 of(String string)
    • read

      public static MD5 read(ByteInput data) throws IOException
      Throws:
      IOException
    • digest

      public static MD5 digest(byte[] input) throws NoSuchAlgorithmException
      Throws:
      NoSuchAlgorithmException
    • 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. 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()
    • write

      public void write(ByteOutput data) throws IOException
      Throws:
      IOException
    • toByteArray

      public byte[] toByteArray()
    • most

      public long most()
      Returns the value of the most record component.
      Returns:
      the value of the most record component
    • least

      public long least()
      Returns the value of the least record component.
      Returns:
      the value of the least record component