public class ContentType extends Object
There is ever growing list of mime types and Stringflow SDK can transport any
content type on the wire as it does not process the content as such (core sdk
only transports it). However content type identification is vital for
applications to process the files (multipart) correctly. ContentType
captures the attributes to represent a valid MimeType. Additionally
it offers convinience methods for application around ContentType
handling.
ContentType should not be confused with MimeType.
MimeType is an enumeration for commonely used mime types allowing
users to avoid processing mime type strings. MimeType does not
represent the list of supported mimes in sdk; on the other hand,
ContentType is a generic way of handling "Content-Type"
mime-header values.
| Constructor and Description |
|---|
ContentType(String mimeType)
Public constructor to instantiate
ContentType from a mimeType;
for example "image/jpeg" will result in a ContentType instance
with type "image" and subtype "jpeg". |
ContentType(String type,
String subtype)
Public constructor to instantiate
ContentType from a mimeType;
Mime Type has two parts: (1) type and (2) subtype. |
| Modifier and Type | Method and Description |
|---|---|
String |
getMimeType() |
boolean |
isAudio() |
boolean |
isImange() |
boolean |
isVideo() |
public ContentType(String mimeType)
ContentType from a mimeType;
for example "image/jpeg" will result in a ContentType instance
with type "image" and subtype "jpeg". If there is only one string is
specified the type will be initialized with that value and subtype will
be null.mimeType - stringIllegalArgumentException - if the mimeType String is not a valid
mimetype string. The validation of mimeType is done only in
terms its construction; for example mimeType argument can not
have more than two slash (/) characters in it.public ContentType(String type, String subtype)
ContentType from a mimeType;
Mime Type has two parts: (1) type and (2) subtype. Although both type and
subtypes are required to represent a valid MIME type; the constructor
enforces only "type" as required argument. If subtype is not given, it be
initialized with null.type - stringsubtype - stringNullPointerException - if the type value is Nullpublic String getMimeType()
public boolean isAudio()
ContentType is an Audio otherwise falsepublic boolean isVideo()
ContentType is an Video otherwise falsepublic boolean isImange()
Copyright © 2019. All rights reserved.