summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-05-08 18:30:30 +0200
committerSimon Rettberg2024-05-08 18:30:30 +0200
commit328793c5e332d879e7f8e14dc9922099f1c0dd8d (patch)
tree7c9d257b512c1ba889737a8808a151a939f83992
parentUtil: Add parseLong and formatBytes (diff)
downloadmaster-sync-shared-328793c5e332d879e7f8e14dc9922099f1c0dd8d.tar.gz
master-sync-shared-328793c5e332d879e7f8e14dc9922099f1c0dd8d.tar.xz
master-sync-shared-328793c5e332d879e7f8e14dc9922099f1c0dd8d.zip
ChunkList: Add writeCrc32List method
-rw-r--r--src/main/java/org/openslx/filetransfer/util/ChunkList.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/filetransfer/util/ChunkList.java b/src/main/java/org/openslx/filetransfer/util/ChunkList.java
index bd927b1..4944847 100644
--- a/src/main/java/org/openslx/filetransfer/util/ChunkList.java
+++ b/src/main/java/org/openslx/filetransfer/util/ChunkList.java
@@ -1,5 +1,6 @@
package org.openslx.filetransfer.util;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -521,4 +522,21 @@ public class ChunkList
return chunk.sha1sum != null && Arrays.equals( FileChunk.NULL_BLOCK_SHA1, chunk.sha1sum );
}
+ /**
+ * Write DNBD3 CRC32 list to given file.
+ *
+ * @throws IllegalStateException
+ * @throws IOException
+ */
+ public void writeCrc32List( String crcfile ) throws IllegalStateException, IOException
+ {
+ byte[] dnbd3Crc32List = null;
+ dnbd3Crc32List = getDnbd3Crc32List();
+ if ( dnbd3Crc32List != null ) {
+ try ( FileOutputStream fos = new FileOutputStream( crcfile ) ) {
+ fos.write( dnbd3Crc32List );
+ }
+ }
+ }
+
}