I followed Sun's example and add extra spaces to fill the fields. This allows my read method to be simpler, because I don't have to check for null characters and can simply read a fixed amount of bytes all at once. Furthermore, it does not violate the requirements, because all fields are full and thus no null characters are needed.
There is, however, one design issue that you should mention if you take this approach. You assume that the data file that came with the assignment will always be padded with spaces and no null characters. In theory, Sun could use another file that does include null characters, because they stated this in the requirements, and that would break my code.
SCJA (94%)<br />SCJP (84%)<br />SCWCD (84%)
Zeng Wei Chu
Joined: Dec 05, 2007
Hi David, thanks for clarifying my doubt. I will stick with the method to pad with spaces. Will add this into my assumptions list.