From b6806878099feceb77f5fe68a408fd8b21502ec7 Mon Sep 17 00:00:00 2001
From: Vojtech Moravec <vojtech.moravec.st@vsb.cz>
Date: Mon, 21 Sep 2020 15:43:01 +0200
Subject: [PATCH] Enable cloning of QCMPFileHeader.

---
 .../azgracompress/fileformat/QCMPFileHeader.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/main/java/azgracompress/fileformat/QCMPFileHeader.java b/src/main/java/azgracompress/fileformat/QCMPFileHeader.java
index 365e963..0a0755a 100644
--- a/src/main/java/azgracompress/fileformat/QCMPFileHeader.java
+++ b/src/main/java/azgracompress/fileformat/QCMPFileHeader.java
@@ -8,7 +8,7 @@ import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 
-public class QCMPFileHeader {
+public class QCMPFileHeader implements Cloneable {
     public static final int BASE_QCMP_HEADER_SIZE = 23;
     public static final String QCMP_MAGIC_VALUE = "QCMPFILE";
 
@@ -57,6 +57,19 @@ public class QCMPFileHeader {
         return true;
     }
 
+    @Override
+    protected Object clone() throws CloneNotSupportedException {
+        return super.clone();
+    }
+
+    public QCMPFileHeader copyOf() {
+        try {
+            return (QCMPFileHeader) this.clone();
+        } catch (CloneNotSupportedException e) {
+            return null;
+        }
+    }
+
     public void writeHeader(DataOutputStream outputStream) throws IOException {
         outputStream.writeBytes(QCMP_MAGIC_VALUE);
 
-- 
GitLab