def read_string(buffer, offset)
      # TODO: Length check
      #   Exception when
      #   - offset exceeds length of buffer
      #   byteslice truncates when too long, but returns nil when start is beyond end of buffer
      len     = buffer.byteslice(offset, 2).unpack('v').first
      offset += 2
      out     = buffer.byteslice(offset, len)
      [out, offset + len]
    end
def read_string(buffer, offset)
      # TODO: Length check
      #   Exception when
      #   - offset exceeds length of buffer
      #   byteslice truncates when too long, but returns nil when start is beyond end of buffer
      len     = buffer.byteslice(offset, 2).unpack('v').first
      offset += 2
      out     = buffer.byteslice(offset, len)
      [out, offset + len]
    end
Extracts a string from the supplied buffer.
 The buffer starts with a 2 byte length indicator in little endian format.

 Parameters
   buffer [String]
   offset [Integer]
     Start position within the buffer.

 Returns [string, offset]
   string [String]
     The string copied from the buffer.
   offset [Integer]
     The new offset within the buffer.