1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-19 04:31:43 +00:00

Download all files from a document as ZIP

This commit is contained in:
jendib
2014-02-23 14:09:41 +01:00
parent ae566018d6
commit 34e3ac5478
6 changed files with 121 additions and 3 deletions

View File

@@ -56,4 +56,29 @@ public class MimeTypeUtil {
return null;
}
/**
* Get a file extension linked to a MIME type.
*
* @param mimeType MIME type
* @return File extension
*/
public static String getFileExtension(String mimeType) {
switch (mimeType) {
case MimeType.APPLICATION_ZIP:
return "zip";
case MimeType.IMAGE_GIF:
return "gif";
case MimeType.IMAGE_JPEG:
return "jpg";
case MimeType.IMAGE_PNG:
return "png";
case MimeType.IMAGE_X_ICON:
return "ico";
case MimeType.APPLICATION_PDF:
return "pdf";
default:
return null;
}
}
}