I have a binary file that I create using Java's output stream. The file is made up of two parts - a header (10 bytes max) that describes the file's remaining contents and then the content itself. The content represents a user's Phone Number. New phone numbers could be added towards the end of the file.
The header contains the last phone number that was added. Hence the first 10 bytes representing the header need to be updated whenever a new phone number is added in order to indicate the last number.
How can I use Java to update only the first 10 bytes (i.e., the header)?
The header is guaranteed to be only 10 bytes.
If I use Java to 'read' the first 10 bytes, then how can I 'write' these to the first - i.e, replace the first 10 bytes?
Example code will increase the points allotted for this question. Thanks in advance!