-
- All Implemented Interfaces:
public class MediaType.Companion
-
-
Field Summary
-
Method Summary
-
-
Method Detail
-
parse
final MediaType parse(String string, String name, String fileExtension)
Creates a MediaType from its RFC 6838 string representation.
- Parameters:
name- A human readable name identifying the media type, which may be presented to the user.fileExtension- The default file extension to use for this media type.
-
of
final MediaType of(String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from a single file extension and media type hint, without checking the actual content.
-
of
final MediaType of(List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from file extension and media type hints, without checking the actual content.
-
of
@Deprecated(message = "Renamed to [ofFile()]", replaceWith = @ReplaceWith(imports = {}, expression = "MediaType.ofFile(file, mediaType, fileExtension, sniffers)"), level = DeprecationLevel.ERROR) final MediaType of(File file, String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
-
of
@Deprecated(message = "Renamed to [ofFile()]", replaceWith = @ReplaceWith(imports = {}, expression = "MediaType.ofFile(file, mediaTypes, fileExtensions, sniffers)"), level = DeprecationLevel.ERROR) final MediaType of(File file, List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
-
of
@Deprecated(message = "Renamed to [ofBytes()]", replaceWith = @ReplaceWith(imports = {}, expression = "MediaType.ofBytes(bytes, mediaType, fileExtension, sniffers)"), level = DeprecationLevel.ERROR) final MediaType of(Function0<ByteArray> bytes, String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
-
of
@Deprecated(message = "Renamed to [ofBytes()]", replaceWith = @ReplaceWith(imports = {}, expression = "MediaType.ofBytes(bytes, mediaTypes, fileExtensions, sniffers)"), level = DeprecationLevel.ERROR) final MediaType of(Function0<ByteArray> bytes, List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
-
of
@Deprecated(message = "Renamed to [ofUri()]", replaceWith = @ReplaceWith(imports = {}, expression = "MediaType.ofUri(uri, contentResolver, mediaType, fileExtension, sniffers)"), level = DeprecationLevel.ERROR) final MediaType of(Uri uri, ContentResolver contentResolver, String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
-
of
@Deprecated(message = "Renamed to [ofUri()]", replaceWith = @ReplaceWith(imports = {}, expression = "MediaType.ofUri(uri, contentResolver, mediaTypes, fileExtensions, sniffers)"), level = DeprecationLevel.ERROR) final MediaType of(Uri uri, ContentResolver contentResolver, List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
-
ofFile
final MediaType ofFile(File file, String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from a local file path.
-
ofFile
final MediaType ofFile(File file, List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from a local file path.
-
ofFile
final MediaType ofFile(String path, String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from a local file path.
-
ofFile
final MediaType ofFile(String path, List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from a local file path.
-
ofBytes
final MediaType ofBytes(Function0<ByteArray> bytes, String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from bytes, e.g. from an HTTP response.
-
ofBytes
final MediaType ofBytes(Function0<ByteArray> bytes, List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from bytes, e.g. from an HTTP response.
-
ofUri
final MediaType ofUri(Uri uri, ContentResolver contentResolver, String mediaType, String fileExtension, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from a content URI and a ContentResolver. Accepts the following URI schemes: content, android.resource, file.
-
ofUri
final MediaType ofUri(Uri uri, ContentResolver contentResolver, List<String> mediaTypes, List<String> fileExtensions, List<SuspendFunction1<SnifferContext, MediaType>> sniffers)
Resolves a format from a content URI and a ContentResolver. Accepts the following URI schemes: content, android.resource, file.
-
getDIVINA_MANIFEST
final MediaType getDIVINA_MANIFEST()
-
getJAVASCRIPT
final MediaType getJAVASCRIPT()
-
getJSON_PROBLEM_DETAILS
final MediaType getJSON_PROBLEM_DETAILS()
-
getLCP_LICENSE_DOCUMENT
final MediaType getLCP_LICENSE_DOCUMENT()
-
getLCP_PROTECTED_AUDIOBOOK
final MediaType getLCP_PROTECTED_AUDIOBOOK()
-
getLCP_PROTECTED_PDF
final MediaType getLCP_PROTECTED_PDF()
-
getLCP_STATUS_DOCUMENT
final MediaType getLCP_STATUS_DOCUMENT()
-
getOPDS1_ENTRY
final MediaType getOPDS1_ENTRY()
-
getOPDS2_PUBLICATION
final MediaType getOPDS2_PUBLICATION()
-
getOPDS_AUTHENTICATION
final MediaType getOPDS_AUTHENTICATION()
-
getREADIUM_AUDIOBOOK
final MediaType getREADIUM_AUDIOBOOK()
-
getREADIUM_AUDIOBOOK_MANIFEST
final MediaType getREADIUM_AUDIOBOOK_MANIFEST()
-
getREADIUM_WEBPUB
final MediaType getREADIUM_WEBPUB()
-
getREADIUM_WEBPUB_MANIFEST
final MediaType getREADIUM_WEBPUB_MANIFEST()
-
getW3C_WPUB_MANIFEST
final MediaType getW3C_WPUB_MANIFEST()
-
getWEBM_AUDIO
final MediaType getWEBM_AUDIO()
-
getWEBM_VIDEO
final MediaType getWEBM_VIDEO()
-
getSniffers
final List<SuspendFunction1<SnifferContext, MediaType>> getSniffers()
The default sniffers provided by Readium 2 to resolve a MediaType. You can register additional sniffers globally by modifying this list. The sniffers order is important, because some formats are subsets of other formats.
-
getAUDIOBOOK
final MediaType getAUDIOBOOK()
-
getAUDIOBOOK_MANIFEST
final MediaType getAUDIOBOOK_MANIFEST()
-
getWEBPUB_MANIFEST
final MediaType getWEBPUB_MANIFEST()
-
getOPDS1_FEED
final MediaType getOPDS1_FEED()
-
getOPDS2_FEED
final MediaType getOPDS2_FEED()
-
getLCP_LICENSE
final MediaType getLCP_LICENSE()
-
-
-
-