Read the information from the flags array.

@param flags the flags found in the frame header
@exception ID3v2FormatException if an error occurs
165829
private void parseFlags(byte[] flags) throws ID3v2FormatException
	{
		if (flags.length != FRAME_FLAGS_SIZE)
		{
			throw new ID3v2FormatException("Error parsing flags of frame: " + id + ".  Expected 2 bytes.");
		}
		else
		{
			tagAlterDiscard = (flags[0]&0x40)!=0;
			fileAlterDiscard = (flags[0]&0x20)!=0;
			readOnly = (flags[0]&0x10)!=0;
			grouped = (flags[1]&0x40)!=0;
			compressed = (flags[1]&0x08)!=0;
			encrypted = (flags[1]&0x04)!=0;
			unsynchronised = (flags[1]&0x02)!=0;
			lengthIndicator = (flags[1]&0x01)!=0;

			if (compressed && !lengthIndicator)
			{
				throw new ID3v2FormatException("Error parsing flags of frame: " + id + ".  Compressed bit set without data length bit set.");
			}
		}
	}
222135
def read_frames(id3, data, frames):
    """"""

    assert id3.version >= ID3Header._V22

    result = []
    unsupported_frames = []

    if id3.version < ID3Header._V24 and id3.f_unsynch:
        try:
            data = unsynch.decode(data)
        except ValueError:
            pass

    if id3.version >= ID3Header._V23:
        if id3.version < ID3Header._V24:
            bpi = int
        else:
            bpi = determine_bpi(data, frames)

        while data:
            header = data[:10]
            try:
                name, size, flags = struct.unpack('>4sLH', header)
            except struct.error:
                break  # not enough header
            if name.strip(b'\x00') == b'':
                break

            size = bpi(size)
            framedata = data[10:10 + size]
            data = data[10 + size:]
            if size == 0:
                continue  # drop empty frames

            if PY3:
                try:
                    name = name.decode('ascii')
                except UnicodeDecodeError:
                    continue

            try:
                # someone writes 2.3 frames with 2.2 names
                if name[-1] == "\x00":
                    tag = Frames_2_2[name[:-1]]
                    name = tag.__base__.__name__

                tag = frames[name]
            except KeyError:
                if is_valid_frame_id(name):
                    unsupported_frames.append(header + framedata)
            else:
                try:
                    result.append(tag._fromData(id3, flags, framedata))
                except NotImplementedError:
                    unsupported_frames.append(header + framedata)
                except ID3JunkFrameError:
                    pass
    elif id3.version >= ID3Header._V22:
        while data:
            header = data[0:6]
            try:
                name, size = struct.unpack('>3s3s', header)
            except struct.error:
                break  # not enough header
            size, = struct.unpack('>L', b'\x00' + size)
            if name.strip(b'\x00') == b'':
                break

            framedata = data[6:6 + size]
            data = data[6 + size:]
            if size == 0:
                continue  # drop empty frames

            if PY3:
                try:
                    name = name.decode('ascii')
                except UnicodeDecodeError:
                    continue

            try:
                tag = frames[name]
            except KeyError:
                if is_valid_frame_id(name):
                    unsupported_frames.append(header + framedata)
            else:
                try:
                    result.append(
                        tag._fromData(id3, 0, framedata))
                except (ID3EncryptionUnsupportedError,
                        NotImplementedError):
                    unsupported_frames.append(header + framedata)
                except ID3JunkFrameError:
                    pass

    return result, unsupported_frames, data
1180246
public Message clearFlag(Flag ... flags) {
        if(flags != null) {
            short tmp=this.flags;
            for(Flag flag : flags)
                if(flag != null)
                    tmp&=~flag.value();
            this.flags=tmp;
        }
        return this;
    }
1218359
@Override
    public synchronized void setFlags(final Flags flag, final boolean set) throws MessagingException {

        super.setFlags(flag, set);

        if (flagChangeListener != null) {
            flagChangeListener.onFlagChange(this, flag, set);
        }

    }
945935
protected boolean containsFlag(final char flag, final String flags) {
        if (flags == null) return false;
        return flags.indexOf(flag) >= 0;
    }
1367984
public void setShowFlags (int flags, boolean on)
    {
        int oldshow = _showFlags;

        if (on) {
            _showFlags |= flags;
        } else {
            _showFlags &= ~flags;
        }

        if (oldshow != _showFlags) {
            showFlagsDidChange(oldshow);
        }
    }
302657
def editheaders():
    """'"""
    # Read stdin - this will be the output from samtools view
    for line in fileinput.input():
        try:
            # Get the flag value from the input
            columns = line.split('\t')
            # The FLAG is in the second column
            flag = int(columns[1])
            # Subtracts 256 from the flag if the & bitwise operator evaluates to true
            # See http://www.tutorialspoint.com/python/bitwise_operators_example.htm
            # For the test case, flags of 256 became 0, and flags of 272 became 16
            columns[1] = str((flag - 256) if (flag & 256) else flag)
            # update = [columns[0], str(flag), columns[2:]]
            sys.stdout.write('\t'.join(columns))
        # Don't fail on IOErrors, or ValueErrors, and still print line to stdout
        except (IOError, ValueError):
            sys.stdout.write(line)
            pass
    # Try except statements to get rid of file closing errors
    try:
        sys.stdout.flush()
        sys.stdout.close()
    except:
        pass
    try:
        sys.stderr.close()
    except:
        pass
725680
private String getTypes(int flags) {
        String types = "";
        if ((flags & CRT_STATEMENT)       != 0) types += " CRT_STATEMENT";
        if ((flags & CRT_BLOCK)           != 0) types += " CRT_BLOCK";
        if ((flags & CRT_ASSIGNMENT)      != 0) types += " CRT_ASSIGNMENT";
        if ((flags & CRT_FLOW_CONTROLLER) != 0) types += " CRT_FLOW_CONTROLLER";
        if ((flags & CRT_FLOW_TARGET)     != 0) types += " CRT_FLOW_TARGET";
        if ((flags & CRT_INVOKE)          != 0) types += " CRT_INVOKE";
        if ((flags & CRT_CREATE)          != 0) types += " CRT_CREATE";
        if ((flags & CRT_BRANCH_TRUE)     != 0) types += " CRT_BRANCH_TRUE";
        if ((flags & CRT_BRANCH_FALSE)    != 0) types += " CRT_BRANCH_FALSE";
        return types;
    }
428094
def getFlags (self, ifname):
        """"""
        try:
            result = self._ioctl(self.SIOCGIFFLAGS, self._getifreq(ifname))
        except IOError as msg:
            log.warn(LOG_CHECK,
                 "error getting flags for interface %r: %s", ifname, msg)
            return 0
        # extract the interface's flags from the return value
        flags, = struct.unpack('H', result[16:18])
        # return "UP" bit
        return flags
1344479
private boolean evaluateConditionFlags(String flags) {
        int p = 0;
        while (true) {
            p = skipBlanks(flags, p);
            if (p >= flags.length()) {
                break;
            }
            boolean complement = false;
            if (flags.charAt(p) == '!') {
                complement = true;
                p++;
            }
            p = skipBlanks(flags, p);
            if (p >= flags.length()) {
                break;
            }
            int p0 = p;
            p = skipNonBlanks(flags, p0 + 1);
            String flag = flags.substring(p0, p).toUpperCase();
            if ((conditionFlags != null && conditionFlags.contains(flag)) ^ complement) {
                return true;
            }
        }
        return false;
    }
927181
@Override public void readFrom(DataInput in) throws IOException, ClassNotFoundException {
        // 1. read the leading byte first
        byte leading=in.readByte();

        // 2. the flags
        flags=in.readShort();

        // 3. dest_addr
        if(Util.isFlagSet(leading, DEST_SET))
            dest=Util.readAddress(in);

        // 4. src_addr
        if(Util.isFlagSet(leading, SRC_SET))
            sender=Util.readAddress(in);

        // 5. headers
        int len=in.readShort();
        this.headers=createHeaders(len);
        for(int i=0; i < len; i++) {
            short id=in.readShort();
            Header hdr=readHeader(in).setProtId(id);
            this.headers[i]=hdr;
        }

        // 6. buf
        if(Util.isFlagSet(leading, BUF_SET)) {
            len=in.readInt();
            buf=new byte[len];
            in.readFully(buf, 0, len);
            length=len;
        }
    }
492907
public AceObjectFlags addFlag(final Flag flag) {
        if (!flags.contains(flag)) {
            flags.add(flag);
        }
        return this;
    }
397291
private final void setFlagValue(byte flagBit, boolean value) {
        if (value) {
            flags = (byte) (getFlags() | flagBit);
        }
        else {
            flags = (byte) (getFlags() & (~flagBit));
        }
    }
508933
public static PrintStmt get(final IPrintStatement<?> _printStmt,
                                final StmtFlag... _flags)
    {
        final PrintStmt ret = new PrintStmt(_flags);
        ret.setEQLStmt(_printStmt);
        return ret;
    }
885443
public static String printFlag(int flags)
    {
        StringBuffer sb = new StringBuffer();
        sb.append(Integer.toHexString(flags));
        sb.append("=");

        if (flags == XAResource.TMNOFLAGS)
        {
            sb.append("TMNOFLAGS");
        }
        else
        {
            if ((flags & XAResource.TMENDRSCAN)   != 0) sb.append("TMENDRSCAN|");
            if ((flags & XAResource.TMFAIL)       != 0) sb.append("TMFAIL|");
            if ((flags & XAResource.TMJOIN)       != 0) sb.append("TMJOIN|");
            if ((flags & XAResource.TMONEPHASE)   != 0) sb.append("TMONEPHASE|");
            if ((flags & XAResource.TMRESUME)     != 0) sb.append("TMRESUME|");
            if ((flags & XAResource.TMSTARTRSCAN) != 0) sb.append("TMSTARTRSCAN|");
            if ((flags & XAResource.TMSUCCESS)    != 0) sb.append("TMSUCCESS|");
            if ((flags & XAResource.TMSUSPEND)    != 0) sb.append("TMSUSPEND|");

            sb.deleteCharAt(sb.length() - 1);
        }
        return sb.toString();
    }
415276
private void readStreamSync() throws IOException {
        int id = 0;
        for (int i = 0; i < 4;) {
            int x = bitStream.readRawUInt(8);
            if (x == Constants.STREAM_SYNC_STRING[i]) {
                i++;
                id = 0;
            } else if (x == ID3V2_TAG[id]) {
                id++;
                i = 0;
                if (id == 3) {
                    skipID3v2Tag();
                    id = 0;
                }
            } else {
                throw new IOException("Could not find Stream Sync");
                //i = 0;
                //id = 0;
            }
        }
    }
148018
private void readHeader() {
        String id = "";
        for (int i = 0; i < 6; i++) {
            id += (char) read();
        }
        if (!id.startsWith("GIF")) {
            header.status = GifDecoder.STATUS_FORMAT_ERROR;
            return;
        }
        readLSD();
        if (header.gctFlag && !err()) {
            header.gct = readColorTable(header.gctSize);
            header.bgColor = header.gct[header.bgIndex];
        }
    }