OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of mime; | 5 part of mime; |
6 | 6 |
7 | 7 |
8 class _MagicNumber { | 8 class _MagicNumber { |
9 final String mimeType; | 9 final String mimeType; |
10 final List<int> numbers; | 10 final List<int> numbers; |
(...skipping 10 matching lines...) Expand all Loading... |
21 } else { | 21 } else { |
22 if (numbers[i] != header[i]) return false; | 22 if (numbers[i] != header[i]) return false; |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 return true; | 26 return true; |
27 } | 27 } |
28 | 28 |
29 } | 29 } |
30 | 30 |
31 int _defaultMagicNumbersMaxLength = 16; | 31 const int _DEFAULT_MAGIC_NUMBERS_MAX_LENGTH = 16; |
32 | 32 |
33 List<_MagicNumber> _defaultMagicNumbers = const [ | 33 const List<_MagicNumber> _DEFAULT_MAGIC_NUMBERS = const [ |
34 const _MagicNumber('application/pdf', const [0x25, 0x50, 0x44, 0x46]), | 34 const _MagicNumber('application/pdf', const [0x25, 0x50, 0x44, 0x46]), |
35 const _MagicNumber('application/postscript', const [0x25, 0x51]), | 35 const _MagicNumber('application/postscript', const [0x25, 0x51]), |
36 const _MagicNumber('image/gif', const [0x47, 0x49, 0x46, 0x38, 0x37, 0x61]), | 36 const _MagicNumber('image/gif', const [0x47, 0x49, 0x46, 0x38, 0x37, 0x61]), |
37 const _MagicNumber('image/gif', const [0x47, 0x49, 0x46, 0x38, 0x39, 0x61]), | 37 const _MagicNumber('image/gif', const [0x47, 0x49, 0x46, 0x38, 0x39, 0x61]), |
38 const _MagicNumber('image/jpeg', const [0xFF, 0xD8]), | 38 const _MagicNumber('image/jpeg', const [0xFF, 0xD8]), |
39 const _MagicNumber('image/png', | 39 const _MagicNumber('image/png', |
40 const [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]), | 40 const [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]), |
41 const _MagicNumber('image/tiff', const [0x49, 0x49, 0x2A, 0x00]), | 41 const _MagicNumber('image/tiff', const [0x49, 0x49, 0x2A, 0x00]), |
42 const _MagicNumber('image/tiff', const [0x4D, 0x4D, 0x00, 0x2A]), | 42 const _MagicNumber('image/tiff', const [0x4D, 0x4D, 0x00, 0x2A]), |
43 const _MagicNumber('video/mp4', | 43 const _MagicNumber( |
44 const [0x00, 0x00, 0x00, 0x00, 0x66, 0x74, | 44 'video/mp4', |
45 0x79, 0x70, 0x33, 0x67, 0x70, 0x35], | 45 const [0x00, 0x00, 0x00, 0x00, 0x66, 0x74, |
46 mask: const [0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, | 46 0x79, 0x70, 0x33, 0x67, 0x70, 0x35], |
47 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]) | 47 mask: const [0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, |
| 48 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]) |
48 ]; | 49 ]; |
49 | |
OLD | NEW |