Interface FileMimeTypeDetector
-
- All Known Implementing Classes:
MimeTypesDetector
public interface FileMimeTypeDetectorProvide mime type detection for Plume File.
Default implementation uses the lightweight library mime-types. This implementation can be easily replaced by Apache Tika if needed (though the dependency is much bigger!).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringguessMimeType(String fileName, PeekingInputStream fileData)Find the corresponding mime type for the file name.
Usage:
-
-
-
Method Detail
-
guessMimeType
@Nullable String guessMimeType(String fileName, PeekingInputStream fileData) throws IOException
Find the corresponding mime type for the file name.
Usage:
InputStream fileStream = ... // First you need the initial file stream PeekingInputStream filePeekingStream = new PeekingInputStream(fileStream); String mimeType = guessMimeType(fileName, filePeekingStream); otherOperationsWithStream(filePeekingStream.peekedStream());- Parameters:
fileName- the file namefileData- The file input stream data wrapped inside a PeekingInputStream- Returns:
- the mime type guessed, null if no one is found
- Throws:
IOException- if the base input stream cannot be read
-
-