예제 #1
0
 public int ForEachByteDesc(IByteProcessor processor)
 {
     if (!_terminated)
     {
         ThrowReplay();
     }
     return(_buffer.ForEachByteDesc(processor));
 }
예제 #2
0
 /// <summary>
 ///     Iterates over the readable bytes of this buffer with the specified <paramref name="processor"/> in descending order.
 /// </summary>
 /// <returns>
 ///     <c>-1</c> if the processor iterated to or beyond the beginning of the readable bytes.
 ///     The last-visited index If the <see cref="IByteProcessor.Process"/> returned <c>false</c>.
 /// </returns>
 public static int ForEachByteDesc(this IByteBuffer buf, IByteProcessor processor)
 {
     if (buf is IByteBuffer2 buffer2)
     {
         return(buffer2.ForEachByteDesc(processor));
     }
     return(buf.ForEachByteDesc(buf.ReaderIndex, buf.ReadableBytes, processor));
 }
예제 #3
0
        static int LastIndexOf(IByteBuffer buffer, int fromIndex, int toIndex, byte value)
        {
            fromIndex = Math.Min(fromIndex, buffer.Capacity);
            if (fromIndex < 0 || buffer.Capacity == 0)
            {
                return(-1);
            }

            return(buffer.ForEachByteDesc(toIndex, fromIndex - toIndex, new ByteProcessor.IndexOfProcessor(value)));
        }
예제 #4
0
 public virtual int ForEachByteDesc(int index, int length, IByteProcessor processor) => Buf.ForEachByteDesc(index, length, processor);
예제 #5
0
        static int LastIndexOf(IByteBuffer buffer, int fromIndex, int toIndex, byte value)
        {
            fromIndex = Math.Min(fromIndex, buffer.Capacity);
            if (fromIndex < 0 || buffer.Capacity == 0)
            {
                return -1;
            }

            return buffer.ForEachByteDesc(toIndex, fromIndex - toIndex, new ByteProcessor.IndexOfProcessor(value));
        }