public byte[] ReadBytesFlipped(int count) { CheckLength(count); var temp = new byte[count]; Buffer.BlockCopy(_buffer, _index, temp, 0, count); EndianConvert.EndianConverter(temp); _index += count; return(temp); }
public unsafe short ReadShort() { CheckLength(2); short value; fixed(byte *ptr = _buffer) { value = *(short *)(ptr + _index); } value = BitConverter.ToInt16(EndianConvert.EndianConverter(BitConverter.GetBytes(value)), 0); _index += 2; return(value); }
public unsafe long ReadLong() { CheckLength(8); long value; fixed(byte *ptr = _buffer) { value = *(long *)(ptr + _index); } value = BitConverter.ToInt64(EndianConvert.EndianConverter(BitConverter.GetBytes(value)), 0); _index += 8; return(value); }
public unsafe int ReadInt() { CheckLength(4); int value; fixed(byte *ptr = _buffer) { value = *(int *)(ptr + _index); } value = BitConverter.ToInt32(EndianConvert.EndianConverter(BitConverter.GetBytes(value)), 0); _index += 4; return(value); }
public void WriteShort(short value = 0) { ThrowIfDisposed(); WriteBytes(EndianConvert.EndianConverter(BitConverter.GetBytes(value))); }
public void WriteLong(long value = 0) { ThrowIfDisposed(); WriteBytes(EndianConvert.EndianConverter(BitConverter.GetBytes(value))); }