Record Class FileMD5

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.io.FileMD5

public record FileMD5(MD5 checksum, long size, Instant lastModified, boolean changed) extends Record
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<FileMD5> CODEC
  • Constructor Details

    • FileMD5

      public FileMD5(MD5 checksum, long size, Instant lastModified, boolean changed)
      Creates an instance of a FileMD5 record class.
      Parameters:
      checksum - the value for the checksum record component
      size - the value for the size record component
      lastModified - the value for the lastModified record component
      changed - the value for the changed record component
  • Method Details

    • read

      public static FileMD5 read(ByteInput data) throws IOException
      Throws:
      IOException
    • loadExisting

      @Nullable public static @Nullable FileMD5 loadExisting(FileInfo fileInfo)
    • load

      public static FileMD5 load(FileInfo fileInfo, @Nullable @Nullable LongConsumer progress) throws IOException
      Throws:
      IOException
    • save

      public static void save(Path file, FileMD5 metadata) throws IOException
      Throws:
      IOException
    • loadChanged

      @Nullable public static @Nullable FileMD5 loadChanged(FileInfo fileInfo, @Nullable @Nullable LongConsumer progress) throws IOException
      Throws:
      IOException
    • write

      public void write(ByteOutput data) throws IOException
      Throws:
      IOException
    • 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. 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:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • checksum

      public MD5 checksum()
      Returns the value of the checksum record component.
      Returns:
      the value of the checksum record component
    • size

      public long size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • lastModified

      public Instant lastModified()
      Returns the value of the lastModified record component.
      Returns:
      the value of the lastModified record component
    • changed

      public boolean changed()
      Returns the value of the changed record component.
      Returns:
      the value of the changed record component