summaryrefslogtreecommitdiff
path: root/BKUCommonGUI/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'BKUCommonGUI/src/main/java/at/gv')
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
new file mode 100644
index 00000000..b0285345
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
@@ -0,0 +1,58 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package at.gv.egiz.stal.impl;
+
+import at.gv.egiz.stal.HashDataInput;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ *
+ * @author clemens
+ */
+public class ByteArrayHashDataInput implements HashDataInput {
+
+ protected byte[] hashData;
+ protected String id;
+ protected String mimeType;
+ protected String encoding;
+
+ public ByteArrayHashDataInput(byte[] hashData, String id, String mimeType, String encoding) {
+ if (hashData == null) {
+ throw new NullPointerException("HashDataInput not provided.");
+ }
+ this.hashData = hashData;
+ this.id = id;
+ this.mimeType = mimeType;
+ this.encoding = encoding;
+ }
+
+ @Override
+ public String getReferenceId() {
+ return id;
+ }
+
+ @Override
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream(hashData);
+ }
+
+ /**
+ * may be null
+ * @return
+ */
+ @Override
+ public String getEncoding() {
+ return encoding;
+ }
+
+
+}