From cf82096145bbdd548e388c1bc25f0e703b9b4624 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 17 Sep 2008 17:17:10 +0000 Subject: hashdatainput digest verification git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@44 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/stal/impl/ByteArrayHashDataInput.java | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/stal') 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; + } + + +} -- cgit v1.2.3