Don't use FileWriter unless you are only writing text.
Without more information I would suggest using XMLEncoder. This has the advantage over binary formats that you can read and even modify the contents. If you don't like XML, I suggest using YAML e.g. snakeyaml and this has a much nicer format.
You would have to lock access to the HashMap to avoid corruption. I also suggest writing to a new file and only deleting the old file when you have written successfully. This avoids loss data in the event of a failure while writing.