@Test public final void testFilesProbeContentTypePathExtension() throws Exception { String contentType = Files.probeContentType(testDirectory.resolve(TEST_HTML)); assertNotNull(contentType); assertEquals("text/html", contentType); }
@Override public String probeContentType(Path path) throws IOException { String fileNameDetect = tika.detect(path.toString()); if(!fileNameDetect.equals(MimeTypes.OCTET_STREAM)) { return fileNameDetect; } String fileContentDetect = tika.detect(path); if(!fileContentDetect.equals(MimeTypes.OCTET_STREAM)) { return fileContentDetect; } return null; }
TikaFileTypeDetector extends FileTypeDetector { @Override public String probeContentType(Path path) throws IOException { String fileNameDetect = tika.detect(path.toString()); if(!fileNameDetect.equals(MimeTypes.OCTET_STREAM)) { return fileNameDetect; } String fileContentDetect = tika.detect(path); if(!fileContentDetect.equals(MimeTypes.OCTET_STREAM)) { return fileContentDetect; } return null; } }
TikaFileTypeDetector extends FileTypeDetector { @Override public String probeContentType(Path path) throws IOException { String fileNameDetect = tika.detect(path.toString()); if(!fileNameDetect.equals(MimeTypes.OCTET_STREAM)) { return fileNameDetect; } String fileContentDetect = tika.detect(path); if(!fileContentDetect.equals(MimeTypes.OCTET_STREAM)) { return fileContentDetect; } return null; } TikaFileTypeDetector(); }
TikaFileTypeDetector extends FileTypeDetector { @Override public String probeContentType(Path path) throws IOException { String fileNameDetect = tika.detect(path.toString()); if(!fileNameDetect.equals(MimeTypes.OCTET_STREAM)) { return fileNameDetect; } String fileContentDetect = tika.detect(path); if(!fileContentDetect.equals(MimeTypes.OCTET_STREAM)) { return fileContentDetect; } return null; } TikaFileTypeDetector(); @Override String probeContentType(Path path); }
TikaFileTypeDetector extends FileTypeDetector { @Override public String probeContentType(Path path) throws IOException { String fileNameDetect = tika.detect(path.toString()); if(!fileNameDetect.equals(MimeTypes.OCTET_STREAM)) { return fileNameDetect; } String fileContentDetect = tika.detect(path); if(!fileContentDetect.equals(MimeTypes.OCTET_STREAM)) { return fileContentDetect; } return null; } TikaFileTypeDetector(); @Override String probeContentType(Path path);  }