addMagicNumber method

void addMagicNumber (
  1. List<int> bytes,
  2. String mimeType,
  3. {List<int> mask}
)

Add a new magic-number mapping to the MimeTypeResolver.

If mask is present,the mask is used to only perform matching on selective bits. The mask must have the same length as bytes.

Implementation

void addMagicNumber(List<int> bytes, String mimeType, {List<int> mask}) {
  if (mask != null && bytes.length != mask.length) {
    throw ArgumentError('Bytes and mask are of different lengths');
  }
  if (bytes.length > _magicNumbersMaxLength) {
    _magicNumbersMaxLength = bytes.length;
  }
  _magicNumbers.add(MagicNumber(mimeType, bytes, mask: mask));
}