iTextSharp.text.pdf.codec.JBIG2SegmentReader.ReadFileHeader C# (CSharp) Method

ReadFileHeader() public method

public ReadFileHeader ( ) : void
return void
        void ReadFileHeader() {
            ra.Seek(0);
            byte[] idstring = new byte[8];
            ra.Read(idstring);
            
            byte[] refidstring = {(byte)0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A};
            
            for ( int i = 0; i < idstring.Length; i++ ) {
                if ( idstring[i] != refidstring[i] ) {
                    throw new InvalidOperationException("file header idstring not good at byte " + i);
                }
            }
            
            int fileheaderflags = ra.Read();

            this.sequential = (( fileheaderflags & 0x1 ) == 0x1);
            this.number_of_pages_known = (( fileheaderflags & 0x2) == 0x0);
            
            if ( (fileheaderflags & 0xfc) != 0x0 ) {
                throw new InvalidOperationException("file header flags bits 2-7 not 0");
            }
            
            if ( this.number_of_pages_known ) {
                this.number_of_pages = ra.ReadInt();
            }
        }