Tizen Native API
5.5
|
The MIME Type API provides functions to map MIME types to file extensions and vice versa.
Required Header
#include <mime_type.h>
Overview
The MIME Type API provides functions to map MIME types to file extensions and vice versa. Conversions are provided from file extensions to MIME types and from MIME types to file extensions.
Note that some MIME types have multiple file extensions or no extension, and the MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
Functions | |
int | mime_type_get_mime_type (const char *file_extension, char **mime_type) |
Gets the MIME type for the given file extension. | |
int | mime_type_get_file_extension (const char *mime_type, char ***file_extension, int *length) |
Gets the file extensions for the given MIME type. | |
int | mime_type_get_mime_type_for_data (const void *data, size_t len, char **mime_type) |
Gets the MIME type for the given data. | |
int | mime_type_get_mime_type_for_file (const char *file_path, char **mime_type) |
Gets the MIME type for the given file path. |
Enumeration Type Documentation
enum mime_type_error_e |
Function Documentation
int mime_type_get_file_extension | ( | const char * | mime_type, |
char *** | file_extension, | ||
int * | length | ||
) |
Gets the file extensions for the given MIME type.
- Since :
- 2.3.1
- Remarks:
- The file_extension must be released with free() by you.
- Parameters:
-
[in] mime_type The MIME type [out] file_extension The array of file extension without the leading dot ('.') [out] length The length of the array of file extension or zero if there is none
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
MIME_TYPE_ERROR_NONE Successful MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory MIME_TYPE_ERROR_IO_ERROR Internal I/O error
- See also:
- mime_type_get_mime_type()
int mime_type_get_mime_type | ( | const char * | file_extension, |
char ** | mime_type | ||
) |
Gets the MIME type for the given file extension.
- Since :
- 2.3.1
- Remarks:
- The mime_type must be released with free() by you.
- Parameters:
-
[in] file_extension The file extension without the leading dot ('.') [out] mime_type The MIME type for the given file extension
The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
MIME_TYPE_ERROR_NONE Successful MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory MIME_TYPE_ERROR_IO_ERROR Internal I/O error
- See also:
- mime_type_get_file_extension()
int mime_type_get_mime_type_for_data | ( | const void * | data, |
size_t | len, | ||
char ** | mime_type | ||
) |
Gets the MIME type for the given data.
- Since :
- 4.0
- Remarks:
- The mime_type must be released with free() by you.
- Parameters:
-
[in] data The stream of file data [in] len The length of data [out] mime_type The MIME type for the given file extension
The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
MIME_TYPE_ERROR_NONE Successful MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory MIME_TYPE_ERROR_IO_ERROR Internal I/O error
int mime_type_get_mime_type_for_file | ( | const char * | file_path, |
char ** | mime_type | ||
) |
Gets the MIME type for the given file path.
- Since :
- 4.0
- Remarks:
- The mime_type must be released with free() by you.
- http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.
- http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
- Parameters:
-
[in] file_path The path of target file [out] mime_type The MIME type for the given file extension
The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
MIME_TYPE_ERROR_NONE Successful MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory MIME_TYPE_ERROR_IO_ERROR Internal I/O error MIME_TYPE_ERROR_PERMISSION_DENIED Permission denied