detect static method

XcfEnvelope? detect(
  1. List<int> bytes
)

Identifies a supported signature, or returns null for an unrelated file.

Implementation

static XcfEnvelope? detect(List<int> bytes) {
  if (XcfCodec.matches(bytes)) {
    return XcfEnvelope.none;
  }
  if (_prefix(bytes, [31, 139])) {
    return XcfEnvelope.gzip;
  }
  if (_prefix(bytes, [66, 90, 104])) {
    return XcfEnvelope.bzip2;
  }
  if (_prefix(bytes, [253, 55, 122, 88, 90, 0])) {
    return XcfEnvelope.xz;
  }
  return null;
}