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

ReadSegment() public method

public ReadSegment ( JBIG2Segment s ) : void
s JBIG2Segment
return void
        void ReadSegment(JBIG2Segment s) {
            int ptr = ra.FilePointer;
            
            if ( s.dataLength == 0xffffffffL ) {
                // TODO figure this bit out, 7.2.7
                return;
            }
            
            byte[] data = new byte[(int)s.dataLength];
            ra.Read(data);
            s.data = data;
            
            if ( s.type == PAGE_INFORMATION ) {
                int last = ra.FilePointer;
                ra.Seek(ptr);
                int page_bitmap_width = ra.ReadInt();
                int page_bitmap_height = ra.ReadInt();
                ra.Seek(last);
                JBIG2Page p = (JBIG2Page)pages[s.page];
                if ( p == null ) {
                    throw new InvalidOperationException("referring to widht/height of page we havent seen yet? " + s.page);
                }
                
                p.pageBitmapWidth = page_bitmap_width;
                p.pageBitmapHeight = page_bitmap_height;
            }
        }