CSJ2K.j2k.image.input.ImgReaderPGM.confirmFileType C# (CSharp) Method

confirmFileType() private method

Checks that the RandomAccessIO begins with 'P5'
If an I/O error occurs. /// If an EOF is read /// ///
private confirmFileType ( ) : void
return void
        private void confirmFileType()
        {
            byte[] type = new byte[]{80, 53}; // 'P5'
            int i;
            byte b;

            for (i = 0; i < 2; i++)
            {
                b = countedByteRead();
                if (b != type[i])
                {
                    if (i == 1 && b == 50)
                    {
                        //i.e 'P2'
                        throw new System.ArgumentException("JJ2000 does not support" + " ascii-PGM files. Use " + " raw-PGM file instead. ");
                    }
                    else
                    {
                        throw new System.ArgumentException("Not a raw-PGM file");
                    }
                }
            }
        }