CSJ2K.j2k.fileformat.reader.FileFormatReader.readFileTypeBox C# (CSharp) Method

readFileTypeBox() public method

This method reads the File Type box.
If an I/O error ocurred. /// If the end of file was reached /// ///
public readFileTypeBox ( ) : bool
return bool
        public virtual bool readFileTypeBox()
        {
            int length;
            long longLength = 0;
            int pos;
            int nComp;
            bool foundComp = false;

            // Get current position in file
            pos = in_Renamed.Pos;

            // Read box length (LBox)
            length = in_Renamed.readInt();
            if (length == 0)
            {
                // This can not be last box
                throw new System.InvalidOperationException("Zero-length of Profile Box");
            }

            // Check that this is a File Type box (TBox)
            if (in_Renamed.readInt() != CSJ2K.j2k.fileformat.FileFormatBoxes.FILE_TYPE_BOX)
            {
                return false;
            }

            // Check for XLBox
            if (length == 1)
            {
                // Box has 8 byte length;
                longLength = in_Renamed.readLong();
                throw new System.IO.IOException("File too long.");
            }

            // Read Brand field
            in_Renamed.readInt();

            // Read MinV field
            in_Renamed.readInt();

            // Check that there is at least one FT_BR entry in in
            // compatibility list
            nComp = (length - 16) / 4; // Number of compatibilities.
            for (int i = nComp; i > 0; i--)
            {
                if (in_Renamed.readInt() == CSJ2K.j2k.fileformat.FileFormatBoxes.FT_BR)
                    foundComp = true;
            }
            if (!foundComp)
            {
                return false;
            }

            return true;
        }