@Test public void canDetectMimeType() throws IOException { String imageType = _ioUtils.getMimeType(this.getClass().getClassLoader().getResourceAsStream("/samples/meds1.jpg")); assertNotNull("The detected audioType must not be null.", imageType); String videoType = _ioUtils.getMimeType(this.getClass().getClassLoader().getResourceAsStream("/samples/mpeg_vid.mpg")); assertNotNull("The detected audioType must not be null.", videoType); String audioType = _ioUtils.getMimeType(this.getClass().getClassLoader().getResourceAsStream("/samples/green.wav")); assertNotNull("The detected audioType must not be null.", audioType); }
public String getMimeType(URL url) throws WfmProcessingException { Validate.notNull(url, "The url parameter must not be null."); String mimeType; try { mimeType = tikaInstance.detect(url); } catch (IOException ioe) { throw new WfmProcessingException(String.format("Exception occurred when getting mime type of %s", url), ioe); } return mimeType; }
IoUtils { public String getMimeType(URL url) throws WfmProcessingException { Validate.notNull(url, "The url parameter must not be null."); String mimeType; try { mimeType = tikaInstance.detect(url); } catch (IOException ioe) { throw new WfmProcessingException(String.format("Exception occurred when getting mime type of %s", url), ioe); } return mimeType; } }
IoUtils { public String getMimeType(URL url) throws WfmProcessingException { Validate.notNull(url, "The url parameter must not be null."); String mimeType; try { mimeType = tikaInstance.detect(url); } catch (IOException ioe) { throw new WfmProcessingException(String.format("Exception occurred when getting mime type of %s", url), ioe); } return mimeType; }  }
IoUtils { public String getMimeType(URL url) throws WfmProcessingException { Validate.notNull(url, "The url parameter must not be null."); String mimeType; try { mimeType = tikaInstance.detect(url); } catch (IOException ioe) { throw new WfmProcessingException(String.format("Exception occurred when getting mime type of %s", url), ioe); } return mimeType; }  String getMimeType(URL url); String getMimeType(String absolutePath); String getMimeType(byte[] bytes); String getMimeType(File file); String getMimeType(Path path); String getMimeType(InputStream inputStream); MediaType getMediaTypeFromMimeType(String mimeType); MediaType getMediaType(URL url); URI findFile(String path); File getNewFileName(String directory, String filename); boolean isApprovedFile(File file); boolean isApprovedFile(URL url); boolean isApprovedContentType(String contentType); static void closeQuietly(Closeable closeable); static Optional<Path> toLocalPath(String pathOrUri); static URL toUrl(String pathOrUri); static InputStream openStream(String pathOrUri); static void deleteEmptyDirectoriesRecursively(Path startDir); static void writeFileAsAttachment(Path path, HttpServletResponse response); static void writeContentAsAttachment(
            InputStream inputStream,
            HttpServletResponse response,
            String fileName,
            String mimeType,
            long contentLength); static String normalizeUri(String uriString); }
IoUtils { public String getMimeType(URL url) throws WfmProcessingException { Validate.notNull(url, "The url parameter must not be null."); String mimeType; try { mimeType = tikaInstance.detect(url); } catch (IOException ioe) { throw new WfmProcessingException(String.format("Exception occurred when getting mime type of %s", url), ioe); } return mimeType; }  String getMimeType(URL url); String getMimeType(String absolutePath); String getMimeType(byte[] bytes); String getMimeType(File file); String getMimeType(Path path); String getMimeType(InputStream inputStream); MediaType getMediaTypeFromMimeType(String mimeType); MediaType getMediaType(URL url); URI findFile(String path); File getNewFileName(String directory, String filename); boolean isApprovedFile(File file); boolean isApprovedFile(URL url); boolean isApprovedContentType(String contentType); static void closeQuietly(Closeable closeable); static Optional<Path> toLocalPath(String pathOrUri); static URL toUrl(String pathOrUri); static InputStream openStream(String pathOrUri); static void deleteEmptyDirectoriesRecursively(Path startDir); static void writeFileAsAttachment(Path path, HttpServletResponse response); static void writeContentAsAttachment(
            InputStream inputStream,
            HttpServletResponse response,
            String fileName,
            String mimeType,
            long contentLength); static String normalizeUri(String uriString); static final String REF; }