CopyBytes() public method

Copies bytes from input buffer to output buffer starting at output[offset]. You have to make sure, that the buffer is byte aligned. If not enough bytes are available, copies fewer bytes.
/// Length is less than zero /// /// Bit buffer isnt byte aligned ///
public CopyBytes ( byte output, int offset, int length ) : int
output byte /// The buffer to copy bytes to. ///
offset int /// The offset in the buffer at which copying starts ///
length int /// The length to copy, 0 is allowed. ///
return int
        public int CopyStored(StreamManipulator input, int length)
        {
            length = Math.Min(Math.Min(length, WindowSize - windowFilled), input.AvailableBytes);
            int copied;

            int tailLen = WindowSize - windowEnd;
            if (length > tailLen) {
                copied = input.CopyBytes(window, windowEnd, tailLen);
                if (copied == tailLen) {
                    copied += input.CopyBytes(window, 0, length - tailLen);
                }
            } else {
                copied = input.CopyBytes(window, windowEnd, length);
            }

            windowEnd = (windowEnd + copied) & WindowMask;
            windowFilled += copied;
            return copied;
        }
示例#2
0
 public int CopyStored(StreamManipulator input, int length)
 {
     int num;
     length = Math.Min(Math.Min(length, 0x8000 - this.windowFilled), input.AvailableBytes);
     int num2 = 0x8000 - this.windowEnd;
     if (length > num2)
     {
         num = input.CopyBytes(this.window, this.windowEnd, num2);
         if (num == num2)
         {
             num += input.CopyBytes(this.window, 0, length - num2);
         }
     }
     else
     {
         num = input.CopyBytes(this.window, this.windowEnd, length);
     }
     this.windowEnd = (this.windowEnd + num) & 0x7fff;
     this.windowFilled += num;
     return num;
 }
示例#3
0
 public int CopyStored(StreamManipulator input, int length)
 {
     length = Math.Min(Math.Min(length, 32768 - this.windowFilled), input.AvailableBytes);
     int num = 32768 - this.windowEnd;
     int num2;
     if (length > num)
     {
         num2 = input.CopyBytes(this.window, this.windowEnd, num);
         if (num2 == num)
         {
             num2 += input.CopyBytes(this.window, 0, length - num);
         }
     }
     else
     {
         num2 = input.CopyBytes(this.window, this.windowEnd, length);
     }
     this.windowEnd = (this.windowEnd + num2 & 32767);
     this.windowFilled += num2;
     return num2;
 }
示例#4
0
        public int CopyStored(StreamManipulator input, int length)
        {
            length = Math.Min(Math.Min(length, 32768 - windowFilled), input.AvailableBytes);
            int num = 32768 - windowEnd;
            int num2;

            if (length > num)
            {
                num2 = input.CopyBytes(window, windowEnd, num);
                if (num2 == num)
                {
                    num2 += input.CopyBytes(window, 0, length - num);
                }
            }
            else
            {
                num2 = input.CopyBytes(window, windowEnd, length);
            }
            windowEnd     = ((windowEnd + num2) & 0x7FFF);
            windowFilled += num2;
            return(num2);
        }
示例#5
0
        public int CopyStored(StreamManipulator input, int length)
        {
            int num;

            length = Math.Min(Math.Min(length, 0x8000 - this.windowFilled), input.AvailableBytes);
            int num2 = 0x8000 - this.windowEnd;

            if (length > num2)
            {
                num = input.CopyBytes(this.window, this.windowEnd, num2);
                if (num == num2)
                {
                    num += input.CopyBytes(this.window, 0, length - num2);
                }
            }
            else
            {
                num = input.CopyBytes(this.window, this.windowEnd, length);
            }
            this.windowEnd     = (this.windowEnd + num) & 0x7fff;
            this.windowFilled += num;
            return(num);
        }
示例#6
0
        public int CopyStored(StreamManipulator input, int len)
        {
            int num;

            len = Math.Min(Math.Min(len, WINDOW_SIZE - this.windowFilled), input.AvailableBytes);
            int length = WINDOW_SIZE - this.windowEnd;

            if (len > length)
            {
                num = input.CopyBytes(this.window, this.windowEnd, length);
                if (num == length)
                {
                    num += input.CopyBytes(this.window, 0, len - length);
                }
            }
            else
            {
                num = input.CopyBytes(this.window, this.windowEnd, len);
            }
            this.windowEnd     = (this.windowEnd + num) & WINDOW_MASK;
            this.windowFilled += num;
            return(num);
        }
示例#7
0
        public int CopyStored(StreamManipulator input, int len)
        {
            len = Math.Min(Math.Min(len, WINDOW_SIZE - window_filled), input.AvailableBytes);
            int copied;

            int tailLen = WINDOW_SIZE - window_end;

            if (len > tailLen)
            {
                copied = input.CopyBytes(window, window_end, tailLen);
                if (copied == tailLen)
                {
                    copied += input.CopyBytes(window, 0, len - tailLen);
                }
            }
            else
            {
                copied = input.CopyBytes(window, window_end, len);
            }

            window_end     = (window_end + copied) & WINDOW_MASK;
            window_filled += copied;
            return(copied);
        }
示例#8
0
        /// <summary>
        /// Copy from input manipulator to internal window
        /// </summary>
        /// <param name="input">source of data</param>
        /// <param name="length">length of data to copy</param>
        /// <returns>the number of bytes copied</returns>
        public int CopyStored(StreamManipulator input, int length)
        {
            length = Math.Min(Math.Min(length, WindowSize - windowFilled), input.AvailableBytes);
            int copied;

            int tailLen = WindowSize - windowEnd;

            if (length > tailLen)
            {
                copied = input.CopyBytes(window, windowEnd, tailLen);
                if (copied == tailLen)
                {
                    copied += input.CopyBytes(window, 0, length - tailLen);
                }
            }
            else
            {
                copied = input.CopyBytes(window, windowEnd, length);
            }

            windowEnd     = (windowEnd + copied) & WindowMask;
            windowFilled += copied;
            return(copied);
        }
示例#9
0
		/// <summary>
		/// Copy from input manipulator to internal window
		/// </summary>
		/// <param name="input">source of data</param>
		/// <param name="len">length of data to copy</param>
		/// <returns>the number of bytes copied</returns>
		public int CopyStored(StreamManipulator input, int len)
		{
			len = Math.Min(Math.Min(len, WINDOW_SIZE - windowFilled), input.AvailableBytes);
			int copied;
			
			int tailLen = WINDOW_SIZE - windowEnd;
			if (len > tailLen) {
				copied = input.CopyBytes(window, windowEnd, tailLen);
				if (copied == tailLen) {
					copied += input.CopyBytes(window, 0, len - tailLen);
				}
			} else {
				copied = input.CopyBytes(window, windowEnd, len);
			}
			
			windowEnd = (windowEnd + copied) & WINDOW_MASK;
			windowFilled += copied;
			return copied;
		}