Ejemplo n.º 1
0
        internal int CopyStored(StreamManipulator input, int length)
        {
            length = Math.Min(Math.Min(length, SIZE - filled), input.availableBytes);
            int copied;

            int tailLen = SIZE - end;

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

            end     = (end + copied) & MASK;
            filled += copied;
            return(copied);
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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;
		}