Tizen Native API
MIME Type

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 file extensions for the given MIME type.

Enumeration Type Documentation

Enumeration for error.

Since :
2.3.1
Enumerator:
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


Function Documentation

int mime_type_get_file_extension ( const char *  mime_type,
char ***  file_extension,
int *  length 
)

Gets file extensions for the given MIME type.

Since :
2.3.1
Remarks:
You must release file_extension using free().
Parameters:
[in]mime_typeThe MIME type
[out]file_extensionThe array of file extensions without the leading dot ('.')
[out]lengthThe length of the array of file extensions otherwise zero if there none are present
Returns:
0 on success, otherwise a negative error value.
Return values:
MIME_TYPE_ERROR_NONESuccessful
MIME_TYPE_ERROR_INVALID_PARAMETERInvalid parameter
MIME_TYPE_ERROR_OUT_OF_MEMORYOut of memory
MIME_TYPE_ERROR_IO_ERRORInternal 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:
You must release mime_type using free().
Parameters:
[in]file_extensionThe file extension without the leading dot ('.')
[out]mime_typeThe 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_NONESuccessful
MIME_TYPE_ERROR_INVALID_PARAMETERInvalid parameter
MIME_TYPE_ERROR_OUT_OF_MEMORYOut of memory
MIME_TYPE_ERROR_IO_ERRORInternal I/O error
See also:
mime_type_get_file_extension()