diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-10-15 13:41:21 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-10-15 13:41:21 +0000 |
commit | d56504bc815d41ac9142967915b7e6224c2cf529 (patch) | |
tree | bbc444d2fe42e062124a901dccd6e7280eccb987 /BKUCommonGUI/src | |
parent | df3f120f1864c23fb4d53622b6667f31cacf8ecc (diff) | |
download | mocca-d56504bc815d41ac9142967915b7e6224c2cf529.tar.gz mocca-d56504bc815d41ac9142967915b7e6224c2cf529.tar.bz2 mocca-d56504bc815d41ac9142967915b7e6224c2cf529.zip |
remove hashdatainputproxy
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@119 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUCommonGUI/src')
-rw-r--r-- | BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java | 31 | ||||
-rw-r--r-- | BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties | 2 |
2 files changed, 32 insertions, 1 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 index b0285345..2b5ee7e7 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java @@ -7,7 +7,11 @@ package at.gv.egiz.stal.impl; import at.gv.egiz.stal.HashDataInput; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.InputStream; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @@ -15,6 +19,8 @@ import java.io.InputStream; */ public class ByteArrayHashDataInput implements HashDataInput { + private static final Log log = LogFactory.getLog(ByteArrayHashDataInput.class); + protected byte[] hashData; protected String id; protected String mimeType; @@ -30,6 +36,31 @@ public class ByteArrayHashDataInput implements HashDataInput { this.encoding = encoding; } + /** + * caches the hashdata input's stream + * @param hdi to be cached + */ + public ByteArrayHashDataInput(HashDataInput hdi) { + if (hdi == null) { + throw new NullPointerException("HashDataInput not provided."); + } + InputStream is = hdi.getHashDataInput(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + byte[] buffer = new byte[1024]; + for (int i = is.read(buffer); i > -1; i = is.read(buffer)) { + baos.write(buffer, 0, i); + } + this.hashData = baos.toByteArray(); + } catch (IOException ex) { + log.error("Failed to cache provided HashDataInput: " + ex.getMessage(), ex); + this.hashData = new byte[0]; + } + this.id = hdi.getReferenceId(); + this.mimeType = hdi.getMimeType(); + this.encoding = hdi.getEncoding(); + } + @Override public String getReferenceId() { return id; diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index d0e4726e..a38e2cf8 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -35,7 +35,7 @@ message.hashdatalist=<html>{0} Signaturdatenobjekte:</html> message.retries=<html>Noch {0} Versuch(e)</html> message.overwrite=<html>M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?</html> label.pin=<html>{0}:</html> -label.pinsize=<html>{0} stellig</html> +label.pinsize=<html>({0} stellig)</html> button.ok=OK button.cancel=Abbrechen button.back=Zur\u00FCck |