Record Class BlockfileChecksummer
java.lang.Object
java.lang.Record
io.datarouter.bytes.blockfile.checksum.BlockfileChecksummer
public record BlockfileChecksummer(String encodedName, int numBytes, Function<byte[],byte[]> encoder)
extends Record
Checksum each block for the purposes of hunting down corruption and potentially skipping invalid blocks.
-
Constructor Summary
ConstructorsConstructorDescriptionBlockfileChecksummer(String encodedName, int numBytes, Function<byte[], byte[]> encoder) Creates an instance of aBlockfileChecksummerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic intbytesToLength(byte[] bytes) static StringbytesToName(byte[] bytes) Returns the value of theencodedNamerecord component.Function<byte[], byte[]> encoder()Returns the value of theencoderrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.byte[]byte[]intnumBytes()Returns the value of thenumBytesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BlockfileChecksummer
Creates an instance of aBlockfileChecksummerrecord class.- Parameters:
encodedName- the value for theencodedNamerecord componentnumBytes- the value for thenumBytesrecord componentencoder- the value for theencoderrecord component
-
-
Method Details
-
lengthToBytes
public byte[] lengthToBytes() -
bytesToLength
public static int bytesToLength(byte[] bytes) -
nameToBytes
public byte[] nameToBytes() -
bytesToName
-
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 '=='. -
encodedName
Returns the value of theencodedNamerecord component.- Returns:
- the value of the
encodedNamerecord component
-
numBytes
public int numBytes()Returns the value of thenumBytesrecord component.- Returns:
- the value of the
numBytesrecord component
-
encoder
Returns the value of theencoderrecord component.- Returns:
- the value of the
encoderrecord component
-