Пример #1
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);
        }
Пример #2
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);
        }
Пример #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;
        }
Пример #4
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;
    }