MimeTypes { public static boolean isBitmapFormat(String format) { final String fmt = expandFormat(format); if (fmt == null) { return false; } return fmt.equals(MIME_JPEG) || fmt.equals(MIME_TIFF) || fmt.equals(MIME_PNG) || fmt.equals(MIME_GIF) || fmt.equals(MIME_BMP); } protected  MimeTypes(); static String expandFormat(String format); static boolean isBitmapFormat(String format); static final String MIME_SVG; static final String MIME_EPS; static final String MIME_TIFF; static final String MIME_JPEG; static final String MIME_PNG; static final String MIME_GIF; static final String MIME_BMP; }
@Test public void testIsBitmapFormat() throws Exception { assertTrue(MimeTypes.isBitmapFormat("tiff")); assertTrue(MimeTypes.isBitmapFormat("tif")); assertTrue(MimeTypes.isBitmapFormat("jpeg")); assertTrue(MimeTypes.isBitmapFormat("jpg")); assertTrue(MimeTypes.isBitmapFormat("gif")); assertTrue(MimeTypes.isBitmapFormat("png")); assertTrue(MimeTypes.isBitmapFormat("image/png")); assertTrue(MimeTypes.isBitmapFormat("image/x-png")); assertFalse(MimeTypes.isBitmapFormat("svg")); assertFalse(MimeTypes.isBitmapFormat("eps")); }