@@ -42,9 +42,11 @@ public final class FileTypeDetector
4242
4343 // https://en.wikipedia.org/wiki/List_of_file_signatures
4444
45+ byte [] iiBytes = "II" .getBytes (StandardCharsets .ISO_8859_1 );
46+ byte [] mmBytes = "MM" .getBytes (StandardCharsets .ISO_8859_1 );
4547 root .addPath (FileType .JPEG , new byte []{(byte )0xff , (byte )0xd8 });
46- root .addPath (FileType .TIFF , "II" . getBytes ( StandardCharsets . ISO_8859_1 ) , new byte []{0x2a , 0x00 });
47- root .addPath (FileType .TIFF , "MM" . getBytes ( StandardCharsets . ISO_8859_1 ) , new byte []{0x00 , 0x2a });
48+ root .addPath (FileType .TIFF , iiBytes , new byte []{0x2a , 0x00 });
49+ root .addPath (FileType .TIFF , mmBytes , new byte []{0x00 , 0x2a });
4850 root .addPath (FileType .PSD , "8BPS" .getBytes (StandardCharsets .ISO_8859_1 ));
4951 root .addPath (FileType .PNG , new byte []{(byte )0x89 , 0x50 , 0x4E , 0x47 , 0x0D , 0x0A , 0x1A , 0x0A , 0x00 , 0x00 , 0x00 , 0x0D , 0x49 , 0x48 , 0x44 , 0x52 });
5052 // TODO technically there are other very rare magic numbers for OS/2 BMP files...
@@ -61,13 +63,13 @@ public final class FileTypeDetector
6163
6264 // https://github.com/drewnoakes/metadata-extractor/issues/217
6365 // root.addPath(FileType.ARW, "II".getBytes(StandardCharsets.ISO_8859_1), new byte[]{0x2a, 0x00, 0x08, 0x00})
64- root .addPath (FileType .CRW , "II" . getBytes ( StandardCharsets . ISO_8859_1 ) , new byte []{0x1a , 0x00 , 0x00 , 0x00 }, "HEAPCCDR" .getBytes (StandardCharsets .ISO_8859_1 ));
65- root .addPath (FileType .CR2 , "II" . getBytes ( StandardCharsets . ISO_8859_1 ) , new byte []{0x2a , 0x00 , 0x10 , 0x00 , 0x00 , 0x00 , 0x43 , 0x52 });
66- root .addPath (FileType .NEF , "MM" . getBytes ( StandardCharsets . ISO_8859_1 ) , new byte []{0x00 , 0x2a , 0x00 , 0x00 , 0x00 , (byte )0x80 , 0x00 });
66+ root .addPath (FileType .CRW , iiBytes , new byte []{0x1a , 0x00 , 0x00 , 0x00 }, "HEAPCCDR" .getBytes (StandardCharsets .ISO_8859_1 ));
67+ root .addPath (FileType .CR2 , iiBytes , new byte []{0x2a , 0x00 , 0x10 , 0x00 , 0x00 , 0x00 , 0x43 , 0x52 });
68+ root .addPath (FileType .NEF , mmBytes , new byte []{0x00 , 0x2a , 0x00 , 0x00 , 0x00 , (byte )0x80 , 0x00 });
6769 root .addPath (FileType .ORF , "IIRO" .getBytes (StandardCharsets .ISO_8859_1 ), new byte []{(byte )0x08 , 0x00 });
6870 root .addPath (FileType .ORF , "IIRS" .getBytes (StandardCharsets .ISO_8859_1 ), new byte []{(byte )0x08 , 0x00 });
6971 root .addPath (FileType .RAF , "FUJIFILMCCD-RAW" .getBytes (StandardCharsets .ISO_8859_1 ));
70- root .addPath (FileType .RW2 , "II" . getBytes ( StandardCharsets . ISO_8859_1 ) , new byte []{0x55 , 0x00 });
72+ root .addPath (FileType .RW2 , iiBytes , new byte []{0x55 , 0x00 });
7173 }
7274
7375 private FileTypeDetector ()
0 commit comments