However the assigment stats that I have to use a DataInputStream and a DataOutputStream.

Are you sure your instructions don't state just something like this : "All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes." ? If true :

It just concerns the header part of the file

Even for the header, the instructions just talk about the format used (for numbers). Formats of RandomAccessFile are 100% compatible with DataInputStream and DataOutputStream classes and implements the same interfaces (DataInput and DataOutput).