using System;

namespace FilterAPI.Networking
{
    public sealed class ByteArraySegment
    {
        public Byte[] Buffer { get; private set; }
        public Int32 Start { get; private set; }
        public Int32 Length { get; private set; }

        public ByteArraySegment(Byte[] TBuffer)
        {
            Start = 0;
            Buffer = TBuffer;
            Length = Buffer.Length;
        }

        public ByteArraySegment(Byte[] TBuffer, Int32 TStart, Int32 TLength)
        {
            Buffer = TBuffer;
            Start = TStart;
            Length = TLength;
        }

        public Boolean Advance(Int32 TLength)
        {
            Start += TLength;
            Length -= TLength;

            return Length <= 0;
        }
    }
}
