BitMiracle.LibJpeg.Classic.jpeg_source_mgr.skip_input_data C# (CSharp) Method

skip_input_data() public method

Skip data - used to skip over a potentially large amount of uninteresting data (such as an APPn marker).
Writers of suspendable-input applications must note that skip_input_data is not granted the right to give a suspension return. If the skip extends beyond the data currently in the buffer, the buffer can be marked empty so that the next read will cause a fill_input_buffer call that can suspend. Arranging for additional bytes to be discarded before reloading the input buffer is the application writer's problem.
public skip_input_data ( int num_bytes ) : void
num_bytes int The number of bytes to skip.
return void
        public virtual void skip_input_data(int num_bytes)
        {
            /* Just a dumb implementation for now.  Could use fseek() except
            * it doesn't work on pipes.  Not clear that being smart is worth
            * any trouble anyway --- large skips are infrequent.
            */
            if (num_bytes > 0)
            {
                while (num_bytes > m_bytes_in_buffer)
                {
                    num_bytes -= m_bytes_in_buffer;
                    fill_input_buffer();
                    /* note we assume that fill_input_buffer will never return false,
                    * so suspension need not be handled.
                    */
                }

                m_position += num_bytes;
                m_bytes_in_buffer -= num_bytes;
            }
        }