The length of the field is dynamic.It should be specified while creating the binary file.
You should use the data class only to determine which position in the binary file contains what.
Just use the reverse process to create the binary file - whatever the data class is reads, your conversion tool should write that to the file.
Hope this helps
Junaid