@Component public final class ContentTypeAcquirer extends Object implements Serializable
Constructor and Description |
---|
ContentTypeAcquirer() |
Modifier and Type | Method and Description |
---|---|
String |
deriveContentTypeFromInputStream(Resource resource)
Return content type from a resource (primarily using it's input stream).
|
String |
getContentTypeFromExtension(String extension)
Returns the content type for the specified extension.
|
String |
getContentTypeFromPushbackInputStream(PushbackInputStream pushbackInputStream)
Get the file content type from a PushbackInputStream (it will do this without consuming any bytes from the
PushbackInputStream stream).
|
Map<String,String> |
getContentTypesMap() |
String |
getExtensionFromContentType(String contentType)
Returns a file extension for a specified content type.
|
String |
getExtensionFromName(String uri) |
Map<String,String> |
getExtensionTypesMap() |
PushbackInputStream |
getPushbackInputStream(InputStream inputStream)
Create a PushbackInputStream which is suitable for passing to the getContentTypeFromPushbackInputStream method.
|
boolean |
isSupportedImageContentType(String contentType) |
boolean |
isSupportedImageExtension(String extension) |
public String deriveContentTypeFromInputStream(Resource resource) throws IOException
resource
- the resourceIOException
public PushbackInputStream getPushbackInputStream(InputStream inputStream)
inputStream
- the file input streampublic String getContentTypeFromPushbackInputStream(PushbackInputStream pushbackInputStream) throws IOException
pushbackInputStream
- the file stream wrapped in a pushbackInputStreamIOException
public String getContentTypeFromExtension(String extension)
extension
- the extension of the filepublic String getExtensionFromContentType(String contentType)
contentType
- the content type of the filepublic boolean isSupportedImageExtension(String extension)
public boolean isSupportedImageContentType(String contentType)
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries