Record Class FileChecksum
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.io.checksum.FileChecksum
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileChecksum(Checksum checksum, long size, Instant lastModified, boolean changed) Creates an instance of aFileChecksumrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanchanged()Returns the value of thechangedrecord component.checksum()Returns the value of thechecksumrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelastModifiedrecord component.static FileChecksumload(ChecksumType<?> type, FileInfo fileInfo, @Nullable LongConsumer progress) static @Nullable FileChecksumloadChanged(ChecksumType<?> type, FileInfo fileInfo, @Nullable LongConsumer progress) static @Nullable FileChecksumloadExisting(ChecksumType<?> type, FileInfo fileInfo) static FileChecksumread(ChecksumType<?> type, ByteInput data) static voidsave(ChecksumType<?> type, Path file, FileChecksum metadata) longsize()Returns the value of thesizerecord component.final StringtoString()Returns a string representation of this record class.voidwrite(ByteOutput data)
-
Field Details
-
CODEC
-
-
Constructor Details
-
FileChecksum
Creates an instance of aFileChecksumrecord class.- Parameters:
checksum- the value for thechecksumrecord componentsize- the value for thesizerecord componentlastModified- the value for thelastModifiedrecord componentchanged- the value for thechangedrecord component
-
-
Method Details
-
read
- Throws:
IOException
-
loadExisting
@Nullable public static @Nullable FileChecksum loadExisting(ChecksumType<?> type, FileInfo fileInfo) -
load
public static FileChecksum load(ChecksumType<?> type, FileInfo fileInfo, @Nullable @Nullable LongConsumer progress) throws IOException - Throws:
IOException
-
save
- Throws:
IOException
-
loadChanged
@Nullable public static @Nullable FileChecksum loadChanged(ChecksumType<?> type, FileInfo fileInfo, @Nullable @Nullable LongConsumer progress) throws IOException - Throws:
IOException
-
write
- Throws:
IOException
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
checksum
Returns the value of thechecksumrecord component.- Returns:
- the value of the
checksumrecord component
-
size
public long size()Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-
lastModified
Returns the value of thelastModifiedrecord component.- Returns:
- the value of the
lastModifiedrecord component
-
changed
public boolean changed()Returns the value of thechangedrecord component.- Returns:
- the value of the
changedrecord component
-