Fix incorrect use of checksum stream

(for some reason each section goes twice through this method)
This commit is contained in:
s809
2023-08-20 20:23:28 +05:00
parent 461302d290
commit 283f4c9782
@@ -215,10 +215,11 @@ public abstract class AbstractMetaDataContainerFile
{
fileChannel.position(METADATA_SIZE_IN_BYTES);
try (DhDataOutputStream compressedOut = new DhDataOutputStream(Channels.newOutputStream(fileChannel));
CheckedOutputStream checkedOut = new CheckedOutputStream(compressedOut, new Adler32())) // TODO: Is Adler32 ok?
try (CheckedOutputStream checkedOut = new CheckedOutputStream(Channels.newOutputStream(fileChannel), new Adler32()); // TODO: Is Adler32 ok?
DhDataOutputStream compressedOut = new DhDataOutputStream(checkedOut))
{
dataWriterFunc.writeBufferToFile(compressedOut);
compressedOut.flush();
this.baseMetaData.checksum = (int) checkedOut.getChecksum().getValue();
}