Ejemplo n.º 1
0
 /// <summary>
 /// Append a specified Init32 type value into the buffer with the specified bit length.
 /// </summary>
 /// <param name="value">Specify the value which needs to be appended.</param>
 /// <param name="length">Specify the bit length which the value will occupy in the buffer.</param>
 public void AppendInit32(int value, int length)
 {
     byte[] convertedBytes = LittleEndianBitConverter.GetBytes(value);
     this.SetBytes(convertedBytes, length);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Append a specified Unit64 type value into the buffer with the specified bit length.
 /// </summary>
 /// <param name="value">Specify the value which needs to be appended.</param>
 /// <param name="length">Specify the bit length which the value will occupy in the buffer.</param>
 public void AppendUInt64(ulong value, int length)
 {
     byte[] convertedBytes = LittleEndianBitConverter.GetBytes(value);
     this.SetBytes(convertedBytes, length);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Read specified bit length content as an UInt16 type and increase the bit offset with the specified length.
 /// </summary>
 /// <param name="readingLength">Specify the reading bit length.</param>
 /// <returns>Return the UInt16 value.</returns>
 public short ReadInt16(int readingLength)
 {
     byte[] uint16Bytes = this.GetBytes(readingLength, 2);
     return(LittleEndianBitConverter.ToInt16(uint16Bytes, 0));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Read specified bit length content as an Int32 type and increase the bit offset with the specified length.
 /// </summary>
 /// <param name="readingLength">Specify the reading bit length.</param>
 /// <returns>Return the Int32 type value.</returns>
 public int ReadInt32(int readingLength)
 {
     byte[] uint32Bytes = this.GetBytes(readingLength, 4);
     return(LittleEndianBitConverter.ToInt32(uint32Bytes, 0));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Read specified bit length content as an UInt64 type and increase the bit offset.
 /// </summary>
 /// <param name="readingLength">Specify the reading bit length.</param>
 /// <returns>Return the UInt64 type value.</returns>
 public ulong ReadUInt64(int readingLength)
 {
     byte[] uint64Bytes = this.GetBytes(readingLength, 8);
     return(LittleEndianBitConverter.ToUInt64(uint64Bytes, 0));
 }