Exemple #1
0
 /// <summary>
 /// Same as using the constructor <see cref="ShortField"/> with the same
 /// parameter list. Avoid creation of an useless object.
 /// </summary>
 /// <param name="offset">offset of the field within its byte array</param>
 /// <param name="value">the initial value</param>
 /// <param name="data">the byte array to write the value to</param>
 public static void Write(int offset, short value, ref byte[] data)
 {
     LittleEndian.PutShort(data, offset, value);
 }
Exemple #2
0
 /// <summary>
 /// set the value from an Stream
 /// </summary>
 /// <param name="stream">the Stream from which the value is to be
 /// read</param>
 /// <exception cref="IOException">if an IOException is thrown from reading
 /// the Stream</exception>
 /// <exception cref="BufferUnderrunException">if there is not enough data
 /// available from the Stream</exception>
 public void ReadFromStream(Stream stream)
 {
     _value = LittleEndian.ReadShort(stream);
 }
Exemple #3
0
 /// <summary>
 /// write the value out to an array of bytes at the appropriate
 /// offset
 /// </summary>
 /// <param name="data">the array of bytes to which the value is to be
 /// written</param>
 /// <exception cref="IndexOutOfRangeException">if the offset is out
 /// of range</exception>
 public void WriteToBytes(byte [] data)
 {
     LittleEndian.PutShort(data, _offset, _value);
 }
Exemple #4
0
 /// <summary>
 /// set the value from its offset into an array of bytes
 /// </summary>
 /// <param name="data">the byte array from which the value is to be read</param>
 /// <exception cref="IndexOutOfRangeException">if the offset is out
 /// of range</exception>
 public void ReadFromBytes(byte [] data)
 {
     _value = LittleEndian.GetShort(data, _offset);
 }