Class MimeUtil

    Definition

    Namespace:
    Tizen.Content.MimeType
    Assembly:
    Tizen.Content.MimeType.dll

    The MimeUtil API provides functions to map the MIME types to file extensions and vice versa.

    public static class MimeUtil
    Inheritance
    object
    MimeUtil
    Remarks

    Conversions are provided from the file extensions to MIME types and from the MIME types to file extensions.

    Methods

    View Source

    GetFileExtension(string)

    Retrieves the file extensions associated with the specified MIME type.

    Declaration
    public static IEnumerable<string> GetFileExtension(string mime)
    Parameters
    Type Name Description
    string mime

    The MIME type for which you want to retrieve the associated file extensions.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T><string>

    An enumerable collection of file extension strings for the specified MIME type.

    Remarks

    By calling this function with a specific MIME type argument, you can obtain a list of file extensions related to that MIME type. These file extensions are returned without the leading period ('.') character.

    Examples

    In the following code snippet, we demonstrate how to utilize the GetFileExtension method by retrieving the file extensions associated with the video/mpeg MIME type:

        var fileExtensions = MimeUtil.GetFileExtension("video/mpeg");
        foreach (var extension in fileExtensions)
        {
            Console.WriteLine(extension);
        }
    View Source

    GetMimeType(string)

    Retrieves the MIME type for the specified file extension. If no specific file format is associated with the given file extension, the default MIME type 'application/octet-stream' is returned.

    Declaration
    public static string GetMimeType(string fileExtension)
    Parameters
    Type Name Description
    string fileExtension

    The file extension for which the MIME type needs to be retrieved.

    Returns
    Type Description
    string

    The MIME type for the specified file extension.

    Remarks

    Conversions are provided from the file extensions to MIME types and from the MIME types to file extensions.

    Examples
        string mimeType = MimeUtil.GetMimeType("png");
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX