public String getMimeType()

in src/main/java/org/apache/sling/commons/contentdetection/internal/ContentAwareMimeTypeServiceImpl.java [49:64]


    public String getMimeType(String filename, InputStream content) throws IOException, IllegalArgumentException {
        if(content == null) {
            return mimeTypeService.getMimeType(filename);
        }
        if(!content.markSupported()) {
            throw new IllegalArgumentException("Supplied InputStream does not support mark/reset");
        }
        MediaType mediaType;
        try (TemporaryResources tmp = new TemporaryResources()){
            TikaInputStream stream = TikaInputStream.get(content, tmp);
            Metadata metadata = new Metadata();
            metadata.set(Metadata.RESOURCE_NAME_KEY, filename);
            mediaType = detector.detect(stream, metadata);
        }
        return mediaType.toString();
    }