public int ForEachByteDesc(IByteProcessor processor) { if (!_terminated) { ThrowReplay(); } return(_buffer.ForEachByteDesc(processor)); }
/// <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)); }
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))); }
public virtual int ForEachByteDesc(int index, int length, IByteProcessor processor) => Buf.ForEachByteDesc(index, length, processor);
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)); }