summaryrefslogtreecommitdiff
path: root/bkucommon/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'bkucommon/src/main')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java43
1 files changed, 2 insertions, 41 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java
index e596e5c8..e51c5823 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java
@@ -27,6 +27,7 @@ package at.gv.egiz.bku.slcommands.impl.cms;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import at.gv.egiz.bku.gui.viewer.MimeTypes;
import at.gv.egiz.stal.HashDataInput;
public class CMSHashDataInput implements HashDataInput {
@@ -58,51 +59,11 @@ public class CMSHashDataInput implements HashDataInput {
@Override
public String getFilename() {
- String fileName = DEFAULT_FILENAME;
- String extension = getExtensionForMimeType(mimeType);
- if (extension != null)
- fileName += extension;
- return fileName;
+ return DEFAULT_FILENAME + MimeTypes.getExtension(mimeType);
}
@Override
public InputStream getHashDataInput() {
return new ByteArrayInputStream(data);
}
- private static String getExtensionForMimeType(String mimeType) {
- if (mimeType.equalsIgnoreCase("application/pdf")) {
- return ".pdf";
- }
- else if (mimeType.equalsIgnoreCase("text/plain")) {
- return ".txt";
- }
- else if (mimeType.equalsIgnoreCase("text/xml")) {
- return ".xml";
- }
- else if (mimeType.equalsIgnoreCase("text/html")) {
- return ".html";
- }
- else if (mimeType.equalsIgnoreCase("application/xml")) {
- return ".xml";
- }
- else if (mimeType.equalsIgnoreCase("application/xhtml+xml")) {
- return ".html";
- }
- else if (mimeType.equalsIgnoreCase("application/zip")) {
- return ".zip";
- }
- else if (mimeType.equalsIgnoreCase("application/gzip")) {
- return ".gz";
- }
- else if (mimeType.equalsIgnoreCase("image/gif")) {
- return ".gif";
- }
- else if (mimeType.equalsIgnoreCase("image/jpeg")) {
- return ".jpg";
- }
- else if (mimeType.equalsIgnoreCase("image/png")) {
- return ".png";
- }
- return null;
- }
}