Debian Codegraph @

src/com/drew/imaging/FileType.java

raw symbols SCIP
1 /*
2 * Copyright 2002-2019 Drew Noakes and contributors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * https://drewnoakes.com/code/exif/
19 * https://github.com/drewnoakes/metadata-extractor
20 */
21 package com.drew.imaging;
22
23 import com.drew.lang.annotations.NotNull;
24 import com.drew.lang.annotations.Nullable;
25
26 /**
27 * Enumeration of supported file types.
28 *
29 * MIME Type Source: https://www.freeformatter.com/mime-types-list.html
30 * https://www.iana.org/assignments/media-types/media-types.xhtml
31 */
32 public enum FileType
33 {
34 Unknown("Unknown", "Unknown", null),
35 Jpeg("JPEG", "Joint Photographic Experts Group", "image/jpeg", "jpg", "jpeg", "jpe"),
36 Tiff("TIFF", "Tagged Image File Format", "image/tiff", "tiff", "tif"),
37 Psd("PSD", "Photoshop Document", "image/vnd.adobe.photoshop", "psd"),
38 Png("PNG", "Portable Network Graphics", "image/png", "png"),
39 Bmp("BMP", "Device Independent Bitmap", "image/bmp", "bmp"),
40 Gif("GIF", "Graphics Interchange Format", "image/gif", "gif"),
41 Ico("ICO", "Windows Icon", "image/x-icon", "ico"),
42 Pcx("PCX", "PiCture eXchange", "image/x-pcx", "pcx"),
43 Riff("RIFF", "Resource Interchange File Format", null),
44 Wav("WAV", "Waveform Audio File Format", "audio/vnd.wave", "wav", "wave"),
45 Avi("AVI", "Audio Video Interleaved", "video/vnd.avi", "avi"),
46 WebP("WebP", "WebP", "image/webp", "webp"),
47 QuickTime("MOV", "QuickTime Movie", "video/quicktime", "mov", "qt"),
48 Mp4("MP4", "MPEG-4 Part 14", "video/mp4", "mp4", "m4a", "m4p", "m4b", "m4r", "m4v"),
49 Heif("HEIF", "High Efficiency Image File Format", "image/heif", "heif", "heic"),
50 Eps("EPS", "Encapsulated PostScript", "application/postscript", "eps", "epsf", "epsi"),
51 Mp3("MP3", "MPEG Audio Layer III", "audio/mpeg", "mp3"),
52
53 /** Sony camera raw. */
54 Arw("ARW", "Sony Camera Raw", null, "arw"),
55 /** Canon camera raw, version 1. */
56 Crw("CRW", "Canon Camera Raw", null, "crw"),
57 /** Canon camera raw, version 2. */
58 Cr2("CR2", "Canon Camera Raw", null, "cr2"),
59 /** Nikon camera raw. */
60 Nef("NEF", "Nikon Camera Raw", null, "nef"),
61 /** Olympus camera raw. */
62 Orf("ORF", "Olympus Camera Raw", null, "orf"),
63 /** FujiFilm camera raw. */
64 Raf("RAF", "FujiFilm Camera Raw", null, "raf"),
65 /** Panasonic camera raw. */
66 Rw2("RW2", "Panasonic Camera Raw", null, "rw2"),
67 /** Canon camera raw (version 3). Shared by CR3 (image) and CRM (video). */
68 Crx("CRX", "Canon Camera Raw", null, "cr3", "crm"),
69
70 // Only file detection
71 Aac("AAC", "Advanced Audio Coding", "audio/aac", "m4a"),
72 Asf("ASF", "Advanced Systems Format", "video/x-ms-asf", "asf", "wma", "wmv"),
73 Cfbf("CFBF", "Compound File Binary Format", null, (String[])null),
74 Flv("FLV", "Flash Video", "video/x-flv", ".flv", ".f4v,"),
75 Indd("INDD", "INDesign Document", "application/octet-stream", ".indd"),
76 Mxf("MXF", "Material Exchange Format", "application/mxf", "mxf"),
77 Pdf("PDF", "Portable Document Format", "application/pdf", "pdf"),
78 Qxp("QXP", "Quark XPress Document", null, "qzp", "qxd"),
79 Ram("RAM", "RealAudio", "audio/vnd.rn-realaudio", "aac", "ra"),
80 Rtf("RTF", "Rich Text Format", "application/rtf", "rtf"),
81 Sit("SIT", "Stuffit Archive", "application/x-stuffit", "sit"),
82 Sitx("SITX", "Stuffit X Archive", "application/x-stuffitx", "sitx"),
83 Swf("SWF", "Small Web Format", "application/vnd.adobe.flash-movie", "swf"),
84 Vob("VOB", "Video Object", "video/dvd", ".vob"),
85 Zip("ZIP", "ZIP Archive", "application/zip", ".zip", ".zipx");
86
87 @NotNull private final String _name;
88 @NotNull private final String _longName;
89 @Nullable private final String _mimeType;
90 private final String[] _extensions;
91
92 FileType(@NotNull String name, @NotNull String longName, @Nullable String mimeType, String... extensions)
93 {
94 _name = name;
95 _longName = longName;
96 _mimeType = mimeType;
97 _extensions = extensions;
98 }
99
100 @NotNull
101 public String getName()
102 {
103 return _name;
104 }
105
106 @NotNull
107 public String getLongName()
108 {
109 return _longName;
110 }
111
112 @Nullable
113 public String getMimeType()
114 {
115 return _mimeType;
116 }
117
118 @Nullable
119 public String getCommonExtension()
120 {
121 return (_extensions == null || _extensions.length == 0) ? null : _extensions[0];
122 }
123
124 @Nullable
125 public String[] getAllExtensions()
126 {
127 return _extensions;
128 }
129 }