encode({ version, assignment, userData = Buffer.alloc(0) }) {
    return new Encoder()
      .writeInt16(version)
      .writeArray(
        Object.keys(assignment).map(topic =>
          new Encoder().writeString(topic).writeArray(assignment[topic])
        )
      )
      .writeBytes(userData).buffer
  }
@param {object} options
@param {number} options.version
@param {Object<String,Array>} options.assignment, example:
                              {
                                'topic-A': [0, 2, 4, 6],
                                'topic-B': [0, 2],
                              }
@param {Buffer} [options.userData=Buffer.alloc(0)]

@returns Buffer