@UnstableApi
public final class FileTypes


Defines common file type constants and helper methods.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation FileTypes.Type

File types.

Constants

static final int
AC3 = 0

File type for the AC-3 and E-AC-3 formats.

static final int
AC4 = 1

File type for the AC-4 format.

static final int
ADTS = 2

File type for the ADTS format.

static final int
AMR = 3

File type for the AMR format.

static final int
AVI = 16

File type for the AVI format.

static final int
BMP = 19

File type for the BMP format.

static final int
FLAC = 4

File type for the FLAC format.

static final int
FLV = 5

File type for the FLV format.

static final int
HEIF = 20

File type for the HEIF format.

static final int
JPEG = 14

File type for the JPEG format.

static final int

File type for the Matroska and WebM formats.

static final int
MIDI = 15

File type for the MIDI format.

static final int
MP3 = 7

File type for the MP3 format.

static final int
MP4 = 8

File type for the MP4 format.

static final int
OGG = 9

File type for the Ogg format.

static final int
PNG = 17

File type for the PNG format.

static final int
PS = 10

File type for the MPEG-PS format.

static final int
TS = 11

File type for the MPEG-TS format.

static final int
UNKNOWN = -1

Unknown file type.

static final int
WAV = 12

File type for the WAV format.

static final int
WEBP = 18

File type for the WEBP format.

static final int
WEBVTT = 13

File type for the WebVTT format.

Public methods

static int

Returns the Type corresponding to the MIME type provided.

static int

Returns the Type corresponding to the response headers provided.

static int

Returns the Type corresponding to the Uri provided.

Constants

AC3

public static final int AC3 = 0

File type for the AC-3 and E-AC-3 formats.

AC4

public static final int AC4 = 1

File type for the AC-4 format.

ADTS

public static final int ADTS = 2

File type for the ADTS format.

AMR

public static final int AMR = 3

File type for the AMR format.

AVI

public static final int AVI = 16

File type for the AVI format.

BMP

public static final int BMP = 19

File type for the BMP format.

FLAC

public static final int FLAC = 4

File type for the FLAC format.

FLV

public static final int FLV = 5

File type for the FLV format.

HEIF

public static final int HEIF = 20

File type for the HEIF format.

JPEG

public static final int JPEG = 14

File type for the JPEG format.

MATROSKA

public static final int MATROSKA = 6

File type for the Matroska and WebM formats.

MIDI

public static final int MIDI = 15

File type for the MIDI format.

MP3

public static final int MP3 = 7

File type for the MP3 format.

MP4

public static final int MP4 = 8

File type for the MP4 format.

OGG

public static final int OGG = 9

File type for the Ogg format.

PNG

public static final int PNG = 17

File type for the PNG format.

PS

public static final int PS = 10

File type for the MPEG-PS format.

TS

public static final int TS = 11

File type for the MPEG-TS format.

UNKNOWN

public static final int UNKNOWN = -1

Unknown file type.

WAV

public static final int WAV = 12

File type for the WAV format.

WEBP

public static final int WEBP = 18

File type for the WEBP format.

WEBVTT

public static final int WEBVTT = 13

File type for the WebVTT format.

Public methods

inferFileTypeFromMimeType

@FileTypes.Type
public static int inferFileTypeFromMimeType(@Nullable String mimeType)

Returns the Type corresponding to the MIME type provided.

Returns UNKNOWN if the MIME type is null.

inferFileTypeFromResponseHeaders

@FileTypes.Type
public static int inferFileTypeFromResponseHeaders(
    Map<StringList<String>> responseHeaders
)

Returns the Type corresponding to the response headers provided.

inferFileTypeFromUri

@FileTypes.Type
public static int inferFileTypeFromUri(Uri uri)

Returns the Type corresponding to the Uri provided.