public class MimeTypes extends Object
| Constructor and Description |
|---|
MimeTypes() |
| Modifier and Type | Method and Description |
|---|---|
static String |
determineMimeType(String fileName,
InputStream stream,
ArtifactType artifactType)
Figures out the mime type of the new artifact given the name of the uploaded file, its content and
the S-RAMP artifact type.
|
static String |
getContentType(File file)
Gets the content type from the given file.
|
static String |
getContentType(String name,
InputStream stream)
Returns the content-type for the given file/resource/artifact name and/or contents.
|
public static String getContentType(File file)
file - public static String getContentType(String name, InputStream stream)
name - the name of the file/resource/artifact or null if not known.stream - the stream containing the data of the file/resource/artifact
or null if none can be provided. Note that the stream MUST support
mark (InputStream.markSupported(). For example the BufferedInputStream
supports this.public static String determineMimeType(String fileName, InputStream stream, ArtifactType artifactType)
fileName - the slug request headerstream - the input stream with the file's data. Consult getContentType(String, java.io.InputStream) for restrictions on the stream.artifactType - the artifact type (based on the endpoint POSTed to)Copyright © 2011–2013 JBoss, a division of Red Hat. All rights reserved.