@Test public void test_ContentTypeDetection_ImgJpeg() { assertEquals(ContentType.IMAGE, MediaMetaDataUtils.classifyUrl(getPath(Image1))); assertEquals (ContentType.IMAGE, MediaMetaDataUtils.classifyUrl(PATH_PREFIX + "image2.jpeg")); }
public static final ContentType classifyUrl(final String path) { try { final String type = MediaChecker.getMimeType(path); if (type.startsWith("image")) { return ContentType.IMAGE; } if (type.startsWith("audio")) { return ContentType.AUDIO; } if (type.startsWith("video")) { return ContentType.VIDEO; } if (type.equals("application/pdf")) { return ContentType.PDF; } if ((type.startsWith("text") || type.equals("application/xml") || type.equals("application/rtf") || type.equals("application/epub")) && !type.contains("html")) { return ContentType.NON_PDF_TEXT; } return ContentType.UNKNOWN; } catch (IOException e) { return ContentType.UNKNOWN; } }
MediaMetaDataUtils { public static final ContentType classifyUrl(final String path) { try { final String type = MediaChecker.getMimeType(path); if (type.startsWith("image")) { return ContentType.IMAGE; } if (type.startsWith("audio")) { return ContentType.AUDIO; } if (type.startsWith("video")) { return ContentType.VIDEO; } if (type.equals("application/pdf")) { return ContentType.PDF; } if ((type.startsWith("text") || type.equals("application/xml") || type.equals("application/rtf") || type.equals("application/epub")) && !type.contains("html")) { return ContentType.NON_PDF_TEXT; } return ContentType.UNKNOWN; } catch (IOException e) { return ContentType.UNKNOWN; } } }
MediaMetaDataUtils { public static final ContentType classifyUrl(final String path) { try { final String type = MediaChecker.getMimeType(path); if (type.startsWith("image")) { return ContentType.IMAGE; } if (type.startsWith("audio")) { return ContentType.AUDIO; } if (type.startsWith("video")) { return ContentType.VIDEO; } if (type.equals("application/pdf")) { return ContentType.PDF; } if ((type.startsWith("text") || type.equals("application/xml") || type.equals("application/rtf") || type.equals("application/epub")) && !type.contains("html")) { return ContentType.NON_PDF_TEXT; } return ContentType.UNKNOWN; } catch (IOException e) { return ContentType.UNKNOWN; } }  }
MediaMetaDataUtils { public static final ContentType classifyUrl(final String path) { try { final String type = MediaChecker.getMimeType(path); if (type.startsWith("image")) { return ContentType.IMAGE; } if (type.startsWith("audio")) { return ContentType.AUDIO; } if (type.startsWith("video")) { return ContentType.VIDEO; } if (type.equals("application/pdf")) { return ContentType.PDF; } if ((type.startsWith("text") || type.equals("application/xml") || type.equals("application/rtf") || type.equals("application/epub")) && !type.contains("html")) { return ContentType.NON_PDF_TEXT; } return ContentType.UNKNOWN; } catch (IOException e) { return ContentType.UNKNOWN; } }  static final ContentType classifyUrl(final String path); final static ImageMetaInfo extractImageMetadata(final String path, final String colorMapPath); final static AudioMetaInfo extractAudioMetadata(final String path); final static VideoMetaInfo extractVideoMetaData(final String path); final static TextMetaInfo extractTextMetaData(final String path); }
MediaMetaDataUtils { public static final ContentType classifyUrl(final String path) { try { final String type = MediaChecker.getMimeType(path); if (type.startsWith("image")) { return ContentType.IMAGE; } if (type.startsWith("audio")) { return ContentType.AUDIO; } if (type.startsWith("video")) { return ContentType.VIDEO; } if (type.equals("application/pdf")) { return ContentType.PDF; } if ((type.startsWith("text") || type.equals("application/xml") || type.equals("application/rtf") || type.equals("application/epub")) && !type.contains("html")) { return ContentType.NON_PDF_TEXT; } return ContentType.UNKNOWN; } catch (IOException e) { return ContentType.UNKNOWN; } }  static final ContentType classifyUrl(final String path); final static ImageMetaInfo extractImageMetadata(final String path, final String colorMapPath); final static AudioMetaInfo extractAudioMetadata(final String path); final static VideoMetaInfo extractVideoMetaData(final String path); final static TextMetaInfo extractTextMetaData(final String path);  }