private static void CheckReadableBounds(IByteBuffer src, int length) { if ((uint)length > (uint)src.ReadableBytes) { ThrowHelper.ThrowIndexOutOfRangeException_ReadableBytes(length, src); } }
public virtual IByteBuffer WriteBytes(IByteBuffer src, int length) { if (length > src.ReadableBytes) { ThrowHelper.ThrowIndexOutOfRangeException_ReadableBytes(length, src); } this.WriteBytes(src, src.ReaderIndex, length); src.SetReaderIndex(src.ReaderIndex + length); return(this); }
public virtual IByteBuffer SetBytes(int index, IByteBuffer src, int length) { Contract.Requires(src != null); this.CheckIndex(index, length); if (length > src.ReadableBytes) { ThrowHelper.ThrowIndexOutOfRangeException_ReadableBytes(length, src); } this.SetBytes(index, src, src.ReaderIndex, length); src.SetReaderIndex(src.ReaderIndex + length); return(this); }