public class ContentTypeDetector extends Object
Constructor and Description |
---|
ContentTypeDetector()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ContentType |
detect(File file)
Detects the content type of the given file.
|
ContentType |
detect(File file,
String fileName)
Detects the content type of the given file.
|
ContentType |
detect(InputStream content)
Detects the content type from the given input stream.
|
ContentType |
detect(InputStream content,
String fileName)
Detects the content type from the given input stream.
|
public ContentType detect(File file) throws IOException
file
- file on which to detect content typeIOException
- problem detecting content typepublic ContentType detect(File file, String fileName) throws IOException
file
- file on which to detect content typefileName
- a file name which can help influence detectionIOException
- problem detecting content typepublic ContentType detect(InputStream content) throws IOException
content
- the content on which to detect content typeIOException
- problem detecting content typepublic ContentType detect(InputStream content, String fileName) throws IOException
content
- the content on which to detect content typefileName
- a file name which can help influence detectionIOException
- problem detecting content typeCopyright © 2009–2021 Norconex Inc.. All rights reserved.