28package com.jogamp.opengl.util.texture;
30import java.io.BufferedInputStream;
31import java.io.IOException;
32import java.io.InputStream;
55 public static final String
T_JPG =
"jpg";
63 public static final String
T_PNG =
"png";
74 public static final String
T_ICNS =
"icns";
85 public static final String
T_ICO =
"ico";
96 public static final String
T_CUR =
"cur";
107 public static final String
T_GIF =
"gif";
121 public static final String
T_BMP =
"bmp";
132 public static final String
T_DIB =
"dib";
143 public static final String
T_DCX =
"dcx";
154 public static final String
T_PCX =
"pcx";
162 public static final String
T_PPM =
"ppm";
173 public static final String
T_PSD =
"psd";
187 public static final String
T_TIFF =
"tiff";
198 public static final String
T_LDF =
"ldf";
220 public static final String
T_DDS =
"dds";
228 public static final String
T_PAM =
"pam";
236 public static final String
T_PGM =
"pgm";
244 public static final String
T_PBM =
"pbm";
255 public static final String
T_3D2 =
"3d2";
266 public static final String
T_3DMF =
"3dmf";
277 public static final String
T_92I =
"92i";
288 public static final String
T_AMFF =
"amff";
299 public static final String
T_ART =
"art";
310 public static final String
T_CALS =
"cals";
321 public static final String
T_CAM =
"cam";
332 public static final String
T_CBD =
"cbd";
344 public static final String
T_CE2 =
"ce2";
355 public static final String
T_CIN =
"cin";
366 public static final String
T_COB =
"cob";
377 public static final String
T_CPT =
"cpt";
388 public static final String
T_CVG =
"cvg";
400 public static final String
T_DEM =
"dem";
411 public static final String
T_DPX =
"dpx";
422 public static final String
T_DRW =
"drw";
433 public static final String
T_DWG =
"dwg";
444 public static final String
T_ECW =
"ecw";
455 public static final String
T_EMF =
"emf";
466 public static final String
T_FPX =
"fpx";
477 public static final String
T_FTS =
"fts";
488 public static final String
T_GRO =
"gro";
499 public static final String
T_HDR =
"hdr";
510 public static final String
T_HRU =
"hru";
521 public static final String
T_IMG =
"img";
543 public static final String
T_IWC =
"iwc";
554 public static final String
T_J6I =
"j6i";
565 public static final String
T_JIF =
"jif";
576 public static final String
T_JP2 =
"jp2";
587 public static final String
T_KDC =
"kdc";
598 public static final String
T_L64 =
"l64";
609 public static final String
T_LBM =
"lbm";
620 public static final String
T_RAD =
"rad";
631 public static final String
T_LWF =
"lwf";
642 public static final String
T_MBM =
"mbm";
653 public static final String
T_MGL =
"mgl";
664 public static final String
T_MIF =
"mif";
675 public static final String
T_MNG =
"mng";
686 public static final String
T_MPW =
"mpw";
697 public static final String
T_MSP =
"msp";
708 public static final String
T_N64 =
"n64";
719 public static final String
T_NCR =
"ncr";
730 public static final String
T_NFF =
"nff";
741 public static final String
T_NGG =
"ngg";
752 public static final String
T_NLM =
"nlm";
763 public static final String
T_NOL =
"nol";
774 public static final String
T_PAL =
"pal";
785 public static final String
T_PAX =
"pax";
796 public static final String
T_PCD =
"pcd";
807 public static final String
T_PCL =
"pcl";
818 public static final String
T_PIC =
"pic";
829 public static final String
T_PIX =
"pix";
840 public static final String
T_POL =
"pol";
851 public static final String
T_PSP =
"psp";
862 public static final String
T_QFX =
"qfx";
873 public static final String
T_QTM =
"qtm";
884 public static final String
T_RAS =
"ras";
895 public static final String
T_RIX =
"rix";
906 public static final String
T_SID =
"sid";
917 public static final String
T_SLD =
"sld";
929 public static final String
T_SOD =
"sod";
941 public static final String
T_WIC =
"wic";
952 public static final String
T_WLM =
"wlm";
963 public static final String
T_WMF =
"wmf";
974 public static final String
T_WPG =
"wpg";
985 public static final String
T_WRL =
"wrl";
996 public static final String
T_XBM =
"xbm";
1007 public static final String
T_XPM =
"xpm";
1015 public static final String
T_TGA =
"tga";
1037 private final int hash;
1044 public ImageType(
final InputStream stream)
throws IOException {
1047 this.header = _header;
1048 this.hash =
null != this.type ? this.type.hashCode() : 0;
1057 this.hash = this.type.hashCode();
1095 public static String
getFileSuffix(
final InputStream stream)
throws IOException {
1108 public static String
getFileSuffix(InputStream stream,
final byte[] b)
throws IOException {
1109 if (stream ==
null) {
1110 throw new IOException(
"Stream was null");
1112 if (!(stream instanceof BufferedInputStream)) {
1113 stream =
new BufferedInputStream(stream);
1115 if (!stream.markSupported()) {
1116 throw new IOException(
"Mark not supported");
1119 throw new IOException(
"Requires "+
MAGIC_MAX_SIZE+
" bytes, has "+stream.available()+
" bytes");
1123 final int bytesRead = stream.read(b);
1125 throw new IOException(
"Could not read "+
MAGIC_MAX_SIZE+
" bytes, read "+bytesRead+
" bytes");
1144 throw new IllegalArgumentException(
"byte array must be >= "+
MAGIC_MAX_SIZE+
", has "+b.length);
1146 final byte b0 = b[0];
1147 final byte b1 = b[1];
1148 final byte b2 = b[2];
1149 final byte b3 = b[3];
1150 final byte b4 = b[4];
1151 final byte b5 = b[5];
1155 if (b0 == (
byte)0x00) {
1156 if (b1 == (
byte)0x00 && b2 == (
byte)0x00 && b3 == (
byte)0x0C &&
1157 b4 == (
byte)0x6A && b5 == (
byte)0x50 &&
1158 b[6] == (
byte)0x20 && b[7] == (
byte)0x20 && b[8] == (
byte)0x0D && b[9] == (
byte)0x0A && b[10] == (
byte)0x87 &&
1159 b[11] == (
byte)0x0A) {
1162 else if (b1 == (
byte)0x01) {
1165 else if (b1 == (
byte)0x02) {
1169 else if (b0 == (
byte)0x01) {
1170 if (b1 == (
byte)0xDA ) {
1173 else if (b1 == (
byte)0xFF && b2 == (
byte)0x02 && b3 == (
byte)0x04 &&
1174 b4 == (
byte)0x03 && b5 == (
byte)0x02) {
1177 else if (b1 == (
byte)0x00 && b2 == (
byte)0x00 && b3 == (
byte)0x00 &&
1178 b4 == (
byte)0x58 && b5 == (
byte)0x00 &&
1179 b[6] == (
byte)0x00 && b[7] == (
byte)0x00) {
1183 else if (b0 == (
byte)0x07 && b1 == (
byte)0x20 && b2 == (
byte)0x4D && b3 == (
byte)0x4D) {
1186 else if (b0 == (
byte)0x0A && b1 == (
byte)0x05 && b2 == (
byte)0x01 && b3 == (
byte)0x08) {
1189 else if (b0 == (
byte)0x1B && b1 == (
byte)0x45 && b2 == (
byte)0x1B && b3 == (
byte)0x26 &&
1190 b4 == (
byte)0x6C && b5 == (
byte)0x30 &&
1191 b[6] == (
byte)0x4F && b[7] == (
byte)0x1B && b[8] == (
byte)0x26 && b[9] == (
byte)0x6C && b[10] == (
byte)0x30 &&
1192 b[11] == (
byte)0x45 && b[12] == (
byte)0x1B && b[13] == (
byte)0x26) {
1195 else if (b0 == (
byte)0x20 && b1 == (
byte)0x77 && b2 == (
byte)0x00 && b3 == (
byte)0x02) {
1198 else if (b0 == (
byte)0x23) {
1199 if (b1 == (
byte)0x20 && b2 == (
byte)0x24 && b3 == (
byte)0x49 &&
1200 b4 == (
byte)0x64 && b5 == (
byte)0x3A &&
1201 b[6] == (
byte)0x20) {
1204 else if (b1 == (
byte)0x56 && b2 == (
byte)0x52 && b3 == (
byte)0x4D &&
1205 b4 == (
byte)0x4C && b5 == (
byte)0x20 &&
1206 b[6] == (
byte)0x56 && b[7] == (
byte)0x32 && b[8] == (
byte)0x2E && b[9] == (
byte)0x30) {
1209 else if (b1 == (
byte)0x64 && b2 == (
byte)0x65 && b3 == (
byte)0x66 &&
1210 b4 == (
byte)0x69 && b5 == (
byte)0x6E &&
1211 b[6] == (
byte)0x65) {
1215 else if (b0 == (
byte)0x2A && b1 == (
byte)0x2A && b2 == (
byte)0x54 && b3 == (
byte)0x49 &&
1216 b4 == (
byte)0x39 && b5 == (
byte)0x32 &&
1217 b[6] == (
byte)0x2A && b[7] == (
byte)0x2A && b[8] == (
byte)0x01 && b[9] == (
byte)0x00 && b[10] == (
byte)0x58 &&
1218 b[11] == (
byte)0x6E && b[12] == (
byte)0x56 && b[13] == (
byte)0x69) {
1221 else if (b0 == (
byte)0x2F && b1 == (
byte)0x2A && b2 == (
byte)0x20 && b3 == (
byte)0x58 &&
1222 b4 == (
byte)0x50 && b5 == (
byte)0x4D &&
1223 b[6] == (
byte)0x20 && b[7] == (
byte)0x2A && b[8] == (
byte)0x2F) {
1226 else if (b0 == (
byte)0x33 && b1 == (
byte)0x44 && b2 == (
byte)0x4D && b3 == (
byte)0x46) {
1229 else if (b0 == (
byte)0x35 && b1 == (
byte)0x4B && b2 == (
byte)0x50 && b3 == (
byte)0x35 &&
1230 b4 == (
byte)0x31 && b5 == (
byte)0x5D &&
1231 b[6] == (
byte)0x2A && b[7] == (
byte)0x67 && b[8] == (
byte)0x72 && b[9] == (
byte)0x72 && b[10] == (
byte)0x80 &&
1232 b[11] == (
byte)0x83 && b[12] == (
byte)0x85 && b[13] == (
byte)0x63) {
1235 else if (b0 == (
byte)0x36 && b1 == (
byte)0x34 && b2 == (
byte)0x4C && b3 == (
byte)0x41 &&
1236 b4 == (
byte)0x4E && b5 == (
byte)0x20 &&
1237 b[6] == (
byte)0x49 && b[7] == (
byte)0x44 && b[8] == (
byte)0x42 && b[9] == (
byte)0x4C && b[10] == (
byte)0x4F &&
1238 b[11] == (
byte)0x43 && b[12] == (
byte)0x4B) {
1241 else if (b0 == (
byte)0x37 && b1 == (
byte)0x00 && b2 == (
byte)0x00 && b3 == (
byte)0x10 &&
1242 b4 == (
byte)0x42 && b5 == (
byte)0x00 &&
1243 b[6] == (
byte)0x00 && b[7] == (
byte)0x10 && b[8] == (
byte)0x00 && b[9] == (
byte)0x00 && b[10] == (
byte)0x00 &&
1244 b[11] == (
byte)0x00 && b[12] == (
byte)0x39 && b[13] == (
byte)0x64) {
1247 else if (b0 == (
byte)0x38 && b1 == (
byte)0x42 && b2 == (
byte)0x50 && b3 == (
byte)0x53 &&
1248 b4 == (
byte)0x00 && b5 == (
byte)0x01 &&
1249 b[6] == (
byte)0x00 && b[7] == (
byte)0x00 && b[8] == (
byte)0x00 && b[9] == (
byte)0x00) {
1252 else if (b0 == (
byte)0x3A && b1 == (
byte)0xDE && b2 == (
byte)0x68 && b3 == (
byte)0xB1) {
1255 else if (b0 == (
byte)0x3D && b1 == (
byte)0x02) {
1258 else if (b0 == (
byte)0x41) {
1259 if (b1 == (
byte)0x43 && b2 == (
byte)0x31 && b3 == (
byte)0x30) {
1262 else if (b1 == (
byte)0x48) {
1265 else if (b1 == (
byte)0x4D && b2 == (
byte)0x46 && b3 == (
byte)0x46) {
1268 else if (b1 == (
byte)0x75 && b2 == (
byte)0x74 && b3 == (
byte)0x6F &&
1269 b4 == (
byte)0x43 && b5 == (
byte)0x41 &&
1270 b[6] == (
byte)0x44 && b[7] == (
byte)0x20 && b[8] == (
byte)0x53 && b[9] == (
byte)0x6C && b[10] == (
byte)0x69 &&
1271 b[11] == (
byte)0x64 && b[12] == (
byte)0x65) {
1275 else if (b0 == (
byte)0x42 && b1 == (
byte)0x4D) {
1276 if (b2 == (
byte)0x36) {
1283 else if (b0 == (
byte)0x43) {
1284 if (b1 == (
byte)0x36 && b2 == (
byte)0x34) {
1287 else if (b1 == (
byte)0x41 && b2 == (
byte)0x4C && b3 == (
byte)0x41 &&
1288 b4 == (
byte)0x4D && b5 == (
byte)0x55 &&
1289 b[6] == (
byte)0x53 && b[7] == (
byte)0x43 && b[8] == (
byte)0x56 && b[9] == (
byte)0x47) {
1292 else if (b1 == (
byte)0x50 && b2 == (
byte)0x54 && b3 == (
byte)0x46 &&
1293 b4 == (
byte)0x49 && b5 == (
byte)0x4C &&
1294 b[6] == (
byte)0x45) {
1297 else if (b1 == (
byte)0x61 && b2 == (
byte)0x6C && b3 == (
byte)0x69 &&
1298 b4 == (
byte)0x67 && b5 == (
byte)0x61 &&
1299 b[6] == (
byte)0x72 && b[7] == (
byte)0x69) {
1303 else if (b0 == (
byte)0x44) {
1304 if (b1 == (
byte)0x44 && b2 == (
byte)0x53 && b3 == (
byte)0x20) {
1307 else if (b1 == (
byte)0x61 && b2 == (
byte)0x6E && b3 == (
byte)0x4D) {
1311 else if (b0 == (
byte)0x45) {
1312 if (b1 == (
byte)0x59 && b2 == (
byte)0x45 && b3 == (
byte)0x53) {
1315 else if (b1 == (
byte)0x78 && b2 == (
byte)0x69 && b3 == (
byte)0x66) {
1324 else if (b0 == (
byte)0x46 && b1 == (
byte)0x4F && b2 == (
byte)0x52 && b3 == (
byte)0x4D) {
1325 if (b4 == (
byte)0x41 && b5 == (
byte)0x54 && b[6] == (
byte)0x3D) {
1332 else if (b0 == (
byte)0x47 && b1 == (
byte)0x49 && b2 == (
byte)0x46 && b3 == (
byte)0x38 &&
1333 (b4 == (
byte)0x37 || b4 == (
byte)0x39) && b5 == (
byte)0x61) {
1336 else if (b0 == (
byte)0x48 && b1 == (
byte)0x50 && b2 == (
byte)0x48 && b3 == (
byte)0x50 &&
1337 b4 == (
byte)0x34 && b5 == (
byte)0x38 &&
1338 b[6] == (
byte)0x2D && b[7] == (
byte)0x45 && b[8] == (
byte)0x1E && b[9] == (
byte)0x2B) {
1341 else if (b0 == (
byte)0x49) {
1342 if (b1 == (
byte)0x49 && b2 == (
byte)0x2A && b3 == (
byte)0x00) {
1343 if (b4 == (
byte)0x08 && b5 == (
byte)0x00 &&
1344 b[6] == (
byte)0x00 && b[7] == (
byte)0x00 && b[8] == (
byte)0x0E && b[9] == (
byte)0x00 && b[10] == (
byte)0x00 &&
1345 b[11] == (
byte)0x01 && b[12] == (
byte)0x04 && b[13] == (
byte)0x00) {
1352 else if (b1 == (
byte)0x57 && b2 == (
byte)0x43 && b3 == (
byte)0x01) {
1356 else if (b0 == (
byte)0x4A) {
1357 if (b1 == (
byte)0x46 && b2 == (
byte)0x49 && b3 == (
byte)0x46) {
1365 else if (b1 == (
byte)0x47 && (b2 == (
byte)0x03 || b2 == (
byte)0x04) && b3 == (
byte)0x0E &&
1366 b4 == (
byte)0x00 && b5 == (
byte)0x00 &&
1367 b[6] == (
byte)0x00) {
1370 else if (b1 == (
byte)0x49 && b2 == (
byte)0x46 && b3 == (
byte)0x39 &&
1371 b4 == (
byte)0x39 && b5 == (
byte)0x61) {
1375 else if (b0 == (
byte)0x4D) {
1376 if (b1 == (
byte)0x47 && b2 == (
byte)0x4C) {
1379 else if (b1 == (
byte)0x4D && b2 == (
byte)0x00 && b3 == (
byte)0x2A) {
1382 else if (b1 == (
byte)0x50 && b2 == (
byte)0x46) {
1386 else if (b0 == (
byte)0x4E) {
1387 if (b1 == (
byte)0x47 && b2 == (
byte)0x47 && b3 == (
byte)0x00 &&
1388 b4 == (
byte)0x01 && b5 == (
byte)0x00) {
1391 else if (b1 == (
byte)0x4C && b2 == (
byte)0x4D && b3 == (
byte)0x20 &&
1392 b4 == (
byte)0x01 && b5 == (
byte)0x02 &&
1393 b[6] == (
byte)0x00) {
1396 else if (b1 == (
byte)0x4F && b2 == (
byte)0x4C && b3 == (
byte)0x00 &&
1397 b4 == (
byte)0x01 && b5 == (
byte)0x00 &&
1398 b[6] == (
byte)0x06 && b[7] == (
byte)0x01 && b[8] == (
byte)0x03 && b[9] == (
byte)0x00) {
1402 else if (b0 == (
byte)0x50) {
1403 if (b1 == (
byte)0x31 || b1 == (
byte)0x34) {
1406 else if (b1 == (
byte)0x32 || b1 == (
byte)0x35) {
1409 else if (b1 == (
byte)0x33 || b1 == (
byte)0x36) {
1412 else if (b1 == (
byte)0x37) {
1415 else if (b1 == (
byte)0x41 && b2 == (
byte)0x58) {
1418 else if (b1 == (
byte)0x49 && b2 == (
byte)0x58 && b3 == (
byte)0x20) {
1421 else if (b1 == (
byte)0x4F && b2 == (
byte)0x4C && b3 == (
byte)0x20 &&
1422 b4 == (
byte)0x46 && b5 == (
byte)0x6F &&
1423 b[6] == (
byte)0x72 && b[7] == (
byte)0x6D && b[8] == (
byte)0x61 && b[9] == (
byte)0x74) {
1426 else if (b1 == (
byte)0x61 && b2 == (
byte)0x69 && b3 == (
byte)0x6E &&
1427 b4 == (
byte)0x74 && b5 == (
byte)0x20 &&
1428 b[6] == (
byte)0x53 && b[7] == (
byte)0x68 && b[8] == (
byte)0x6F && b[9] == (
byte)0x70 && b[10] == (
byte)0x20 &&
1429 b[11] == (
byte)0x50 && b[12] == (
byte)0x72 && b[13] == (
byte)0x6F && b[14] == (
byte)0x20 && b[15] == (
byte)0x49 &&
1430 b[16] == (
byte)0x6D && b[17] == (
byte)0x61 && b[18] == (
byte)0x67 && b[19] == (
byte)0x65 && b[20] == (
byte)0x20 &&
1431 b[21] == (
byte)0x46 && b[22] == (
byte)0x69 && b[23] == (
byte)0x6C && b[24] == (
byte)0x65) {
1435 else if (b0 == (
byte)0x51 && b1 == (
byte)0x4C && b2 == (
byte)0x49 && b3 == (
byte)0x49 &&
1436 b4 == (
byte)0x46 && b5 == (
byte)0x41 &&
1437 b[6] == (
byte)0x58) {
1440 else if (b0 == (
byte)0x52 && b1 == (
byte)0x49 && b2 == (
byte)0x58 && b3 == (
byte)0x33) {
1443 else if (b0 == (
byte)0x53) {
1444 if (b1 == (
byte)0x44 && b2 == (
byte)0x50 && b3 == (
byte)0x58) {
1447 else if (b1 == (
byte)0x49 && b2 == (
byte)0x4D && b3 == (
byte)0x50 &&
1448 b4 == (
byte)0x4C && b5 == (
byte)0x45 &&
1449 b[6] == (
byte)0x20 && b[7] == (
byte)0x20 && b[8] == (
byte)0x3D) {
1452 else if (b1 == (
byte)0x74 && b2 == (
byte)0x6F && b3 == (
byte)0x72 &&
1453 b4 == (
byte)0x6D && b5 == (
byte)0x33 &&
1454 b[6] == (
byte)0x44) {
1457 else if (b1 == (
byte)0x80 && b2 == (
byte)0xf6 && b3 == (
byte)0x34) {
1461 else if (b0 == (
byte)0x56 && b1 == (
byte)0x69 && b2 == (
byte)0x73 && b3 == (
byte)0x74 &&
1462 b4 == (
byte)0x61 && b5 == (
byte)0x20 &&
1463 b[6] == (
byte)0x44 && b[7] == (
byte)0x45 && b[8] == (
byte)0x4D && b[9] == (
byte)0x20 && b[10] == (
byte)0x46 &&
1464 b[11] == (
byte)0x69 && b[12] == (
byte)0x6C && b[13] == (
byte)0x65) {
1467 else if (b0 == (
byte)0x57 && b1 == (
byte)0x56 && b2 == (
byte)0x02 && b3 == (
byte)0x00 &&
1468 b4 == (
byte)0x47 && b5 == (
byte)0x45 &&
1469 b[6] == (
byte)0x00 && b[7] == (
byte)0x0E) {
1472 else if (b0 == (
byte)0x59 && b1 == (
byte)0xA6 && b2 == (
byte)0x6A && b3 == (
byte)0x95) {
1475 else if (b0 == (
byte)0x63 && b1 == (
byte)0x52 && b2 == (
byte)0x01 && b3 == (
byte)0x01 &&
1476 b4 == (
byte)0x38 && b5 == (
byte)0x09 &&
1477 b[6] == (
byte)0x3D && b[7] == (
byte)0x00) {
1480 else if (b0 == (
byte)0x65) {
1481 if (b1 == (
byte)0x02 && b2 == (
byte)0x01 && b3 == (
byte)0x02) {
1484 else if (b1 == (
byte)0x6C && b2 == (
byte)0x6D && b3 == (
byte)0x6F) {
1488 else if (b0 == (
byte)0x69 && b1 == (
byte)0x63 && b2 == (
byte)0x6E && b3 == (
byte)0x73) {
1491 else if (b0 == (
byte)0x6D && b1 == (
byte)0x6F && b2 == (
byte)0x6F && b3 == (
byte)0x76) {
1494 else if (b0 == (
byte)0x6E) {
1495 if (b1 == (
byte)0x63 && b2 == (
byte)0x6F && b3 == (
byte)0x6C &&
1499 else if (b1 == (
byte)0x66 && b2 == (
byte)0x66) {
1502 else if (b1 == (
byte)0x6E && b2 == (
byte)0x0A && b3 == (
byte)0x00 &&
1503 b4 == (
byte)0x5E && b5 == (
byte)0x00) {
1507 else if (b0 == (
byte)0x73 && b1 == (
byte)0x72 && b2 == (
byte)0x63 && b3 == (
byte)0x64 &&
1508 b4 == (
byte)0x6F && b5 == (
byte)0x63 &&
1509 b[6] == (
byte)0x69 && b[7] == (
byte)0x64 && b[8] == (
byte)0x3A) {
1512 else if (b0 == (
byte)0x7B && b1 == (
byte)0x0A && b2 == (
byte)0x20 && b3 == (
byte)0x20 &&
1513 b4 == (
byte)0x43 && b5 == (
byte)0x72 &&
1514 b[6] == (
byte)0x65 && b[7] == (
byte)0x61 && b[8] == (
byte)0x74 && b[9] == (
byte)0x65 && b[10] == (
byte)0x64) {
1517 else if (b0 == (
byte)0x7E && b1 == (
byte)0x42 && b2 == (
byte)0x4B && b3 == (
byte)0x00) {
1520 else if (b0 == (
byte)0x80) {
1521 if (b1 == (
byte)0x2A && b2 == (
byte)0x5F && b3 == (
byte)0xD7 &&
1522 b4 == (
byte)0x00 && b5 == (
byte)0x00 &&
1523 b[6] == (
byte)0x08 && b[7] == (
byte)0x00 && b[8] == (
byte)0x00 && b[9] == (
byte)0x00 && b[10] == (
byte)0x04 &&
1524 b[11] == (
byte)0x00 && b[12] == (
byte)0x00 && b[13] == (
byte)0x00) {
1527 else if (b1 == (
byte)0x3E && b2 == (
byte)0x44 && b3 == (
byte)0x53 &&
1528 b4 == (
byte)0x43 && b5 == (
byte)0x49 &&
1529 b[6] == (
byte)0x4D) {
1533 else if (b0 == (
byte)0x89 && b1 == (
byte)0x50 && b2 == (
byte)0x4E && b3 == (
byte)0x47 &&
1534 b4 == (
byte)0x0D && b5 == (
byte)0x0A && b[6] == (
byte)0x1A && b[7] == (
byte)0x0A) {
1538 else if (b0 == (
byte)0x8A && b1 == (
byte)0x4D && b2 == (
byte)0x4E && b3 == (
byte)0x47 &&
1539 b4 == (
byte)0x0D && b5 == (
byte)0x0A &&
1540 b[6] == (
byte)0x1A && b[7] == (
byte)0x0A) {
1543 else if (b0 == (
byte)0xD0 && b1 == (
byte)0xCF && b2 == (
byte)0x11 && b3 == (
byte)0xE0 &&
1544 b4 == (
byte)0xA1 && b5 == (
byte)0xB1 &&
1545 b[6] == (
byte)0x1A && b[7] == (
byte)0xE1 && b[8] == (
byte)0x00) {
1548 else if (b0 == (
byte)0xD3 && b1 == (
byte)0x23 && b2 == (
byte)0x00 && b3 == (
byte)0x00 &&
1549 b4 == (
byte)0x03 && b5 == (
byte)0x00 &&
1550 b[6] == (
byte)0x00 && b[7] == (
byte)0x00) {
1553 else if (b0 == (
byte)0xD7 && b1 == (
byte)0xCD && b2 == (
byte)0xC6 && b3 == (
byte)0x9A) {
1556 else if (b0 == (
byte)0xEB && b1 == (
byte)0x3C && b2 == (
byte)0x90 && b3 == (
byte)0x2A) {
1559 else if (b0 == (
byte)0xFA && b1 == (
byte)0xDE && b2 == (
byte)0xBA && b3 == (
byte)0xBE &&
1560 b4 == (
byte)0x01 && b5 == (
byte)0x01) {
1563 else if (b0 == (
byte)0xFF) {
1564 if (b1 == (
byte)0xD8 ) {
1572 else if (b1 == (
byte)0x57 && b2 == (
byte)0x50 && b3 == (
byte)0x43 && b4 == (
byte)0x10) {
Static utility functions for ImageType to determine the ImageType#type.
static String getFileSuffix(InputStream stream, final byte[] b)
Determines the file suffix (i.e the image format) of the given InputStream.
static String getFileSuffix(final InputStream stream)
Determines the file suffix (i.e the image format) of the given InputStream.
static String getFileSuffix(final byte[] b)
Determines the file suffix (i.e the image format) of the given bytes from the header of a file.
Image type classification.
static final String T_WPG
Constant which can be used as a file suffix to indicate a Wordperfect Graphics vectors stream,...
static final String T_JIF
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_FPX
Constant which can be used as a file suffix to indicate a FlashPix stream, value {@value}.
static final String T_GIF
Constant which can be used as a file suffix to indicate a GIF stream, value {@value}.
static final String T_LDF
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_DPX
Constant which can be used as a file suffix to indicate a Digital Picture Exchange stream,...
static final String T_PSP
Constant which can be used as a file suffix to indicate a PaintShop Pro stream, value {@value}.
static final String T_WLM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_QTM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_N64
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_MNG
Constant which can be used as a file suffix to indicate a Multiple-image Network Graphics stream,...
static final String T_CPT
Constant which can be used as a file suffix to indicate a Corel Photo Paint stream,...
static final String T_POL
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
ImageType(final InputStream stream)
Creates instance based on given stream.
static final String T_PCL
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_JP2
Constant which can be used as a file suffix to indicate a JPEG-2000 stream, value {@value}.
static final String T_3D2
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
ImageType(final String type)
Creates instance based on the given type.
static final String T_PIC
Constant which can be used as a file suffix to indicate a Softimage pic stream, value {@value}.
static final String T_LWF
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_DWG
Constant which can be used as a file suffix to indicate a Autocad drawing stream, value {@value}.
static final String T_COB
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_NLM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_3DMF
Constant which can be used as a file suffix to indicate an Apple QuickDraw 3D 3DMF stream,...
static final String T_HRU
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_XBM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_INFINI_D
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_IWC
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_XPM
Constant which can be used as a file suffix to indicate a X PixMap stream, value {@value}.
static final String T_PCD
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_DEM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_NCR
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_TGA
Constant which can be used as a file suffix to indicate a Targa stream, value {@value}.
static final String T_J6I
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_AMFF
Constant which can be used as a file suffix to indicate an Amiga metafile stream, value {@value}.
static final String T_RAD
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_SOD
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_RIX
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_GRO
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_CAM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
final boolean isDefined()
Returns true if type is determined, i.e.
static final String T_CVG
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_DCX
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_WMF
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_RAS
Constant which can be used as a file suffix to indicate a Sun Raster stream, value {@value}.
static final String T_PSD
Constant which can be used as a file suffix to indicate a Adobe PhotoShop stream, value {@value}.
static final String T_L64
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_SGI_RGB
Constant which can be used as a file suffix to indicate an SGI RGB stream, value {@value}.
static final String T_92I
Constant which can be used as a file suffix to indicate a Texas Instruments TI-92 Bitmap stream,...
static final String T_QFX
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_SID
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
boolean equals(final Object o)
static final String T_SLD
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_ICO
Constant which can be used as a file suffix to indicate a Microsoft Windows Icon stream,...
static final String T_DIB
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final int MAGIC_MAX_SIZE
Minimum number of bytes to determine the image data type, i.e.
static final String T_PBM
Constant which can be used as a file suffix to indicate a PGM stream, NetPbm magic 4 - binary monochr...
static final String T_PPM
Constant which can be used as a file suffix to indicate a PAM stream, NetPbm magic 6 - binary RGB.
static final String T_PNG
Constant which can be used as a file suffix to indicate a PNG stream, value {@value}.
static final String T_CIN
Constant which can be used as a file suffix to indicate a Kodak Cineon System stream,...
static final String T_PGM
Constant which can be used as a file suffix to indicate a PGM stream, NetPbm magic 5 - binary graysca...
static final String T_LBM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_MSP
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_PAL
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_TIFF
Constant which can be used as a file suffix to indicate a TIFF stream, value {@value}.
static final String T_CALS
Constant which can be used as a file suffix to indicate a United States Department of Defence Continu...
final String type
The determined unique type, e.g.
static final String T_MBM
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_CBD
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
final byte[] header
The optionally read header of size MAGIC_MAX_SIZE bytes as used to determine the type,...
static final String T_MIF
Constant which can be used as a file suffix to indicate an Imagemagick stream, value {@value}.
static final String T_HDR
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_IMG
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_FTS
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_PAM
Constant which can be used as a file suffix to indicate a Portable Arbitrary Map stream,...
static final String T_MPW
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_PCX
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_WRL
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_NGG
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_DRW
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_ICNS
Constant which can be used as a file suffix to indicate an Apple Icon Image stream,...
static final String T_DDS
Constant which can be used as a file suffix to indicate a DirectDraw Surface stream,...
static final String T_NOL
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_WIC
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_CE2
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_PIX
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_ECW
Constant which can be used as a file suffix to indicate a Hexagon Geospatial Enhanced Compression Wav...
static final String T_PAX
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_MGL
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_BMP
Constant which can be used as a file suffix to indicate a GIF stream, value {@value}.
static final String T_KDC
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_ART
Constant which can be used as a file suffix to indicate an America Online Art stream,...
static final String T_CUR
Constant which can be used as a file suffix to indicate a Microsoft Windows Cursor stream,...
static final String T_JPG
Constant which can be used as a file suffix to indicate a JPEG stream, value {@value}.
static final String T_NFF
Constant which can be used as a file suffix to indicate a TBD stream, value {@value}.
static final String T_EMF
Constant which can be used as a file suffix to indicate a Microsoft Windows Enhanced metafile stream,...