code: function strbuf(str) {
    var b = new ByteBuffer(str.length + 4);
  
    b.setUint16 (0, str.length, true);
  
    for (var i = 0; i < str.length; i += 2) {
      b.setUint16 (i + 2, str.getUint16 (i), true);
    }
  
    b.setUint16 (b.length - 2, 0, true);
  
    return b;
  }
docs: Utility function to convert buffer of utf16be chars to buffer of utf16le
  chars prefixed with length and suffixed with zero