List of usage examples for com.google.common.net MediaType OOXML_DOCUMENT
MediaType OOXML_DOCUMENT
To view the source code for com.google.common.net MediaType OOXML_DOCUMENT.
Click Source Link
From source file:helper.ThumbnailGenerator.java
private static File generateMimeTypeImage(MediaType contentType, int size, String name) { File result = null;//from w w w. j a v a2 s . com try { if (contentType.is(MediaType.ANY_AUDIO_TYPE)) { result = generateThumbnailFromImage(Play.application().resourceAsStream(AUDIO_PIC), size, "png", name); } else if (contentType.is(MediaType.ANY_IMAGE_TYPE)) { result = generateThumbnailFromImage(Play.application().resourceAsStream(IMAGE_PIC), size, "png", name); } else if (contentType.is(MediaType.ANY_TEXT_TYPE) || contentType.is(MediaType.OOXML_DOCUMENT) || contentType.is(MediaType.MICROSOFT_WORD)) { result = generateThumbnailFromImage(Play.application().resourceAsStream(TEXT_PIC), size, "png", name); } else if (contentType.is(MediaType.ANY_VIDEO_TYPE)) { result = generateThumbnailFromImage(Play.application().resourceAsStream(VIDEO_PIC), size, "png", name); } else if (contentType.is(MediaType.ZIP)) { result = generateThumbnailFromImage(Play.application().resourceAsStream(ZIP_PIC), size, "png", name); } else if (contentType.is(MediaType.PDF)) { result = generateThumbnailFromImage(Play.application().resourceAsStream(PDF_PIC), size, "png", name); } else { result = generateThumbnailFromImage(Play.application().resourceAsStream(MIMETYPE_NOT_FOUND_PIC), size, "png", name); } } catch (Throwable e) { play.Logger.warn("", e); result = generateThumbnailFromImage(Play.application().resourceAsStream(EXCEPTION_ON_APPLY_MIMETYPE), size, "png", name); } return result; }