Fan.Sys.MemBuf.MemBufInStream.unread C# (CSharp) Méthode

unread() public méthode

public unread ( int n ) : InStream
n int
Résultat InStream
            public override InStream unread(int n)
            {
                // unreading a buffer is a bit weird - the typical case
                // is that we are pushing back the byte we just read in
                // which case we can just rewind the position; however
                // if we pushing back a different byte then we need
                // to shift the entire buffer and insert the byte
                if (p.m_pos > 0 && p.m_buf[p.m_pos-1] == (byte)n)
                {
                  p.m_pos--;
                }
                else
                {
                  if (p.m_size+1 >= p.m_buf.Length) p.grow(p.m_size+1);
                  System.Array.Copy(p.m_buf, p.m_pos, p.m_buf, p.m_pos+1, p.m_size);
                  p.m_buf[p.m_pos] = (byte)n;
                  p.m_size++;
                }
                return this;
            }

Same methods

MemBuf.MemBufInStream::unread ( long n ) : InStream