mayOnlyBe method

TarFormat mayOnlyBe(
  1. TarFormat other
)

Returns a new TarFormat that signifies that it can only be other's format.

Example:

TarFormat format = TarFormat.PAX | TarFormat.USTAR;
...
format = format.mayOnlyBe(TarFormat.USTAR);

In the above example, we found that format could either be PAX or USTAR, but later learnt that it can only be the USTAR format.

If has(other) == false, mayOnlyBe will result in an unknown TarFormat.

Implementation

TarFormat mayOnlyBe(TarFormat other) {
  return TarFormat._internal(_value & other._value);
}