I need to store an integer in a persistent media. The only option i can think is the disk.. so i'm trying to write a file in the cwd.
This must be done as quickly as possible, and need to assume that the files is really synced in the HD, because this must be power off safe.
I have tried a lot of approaches, and i cant get less than 200ms to write this file.
What i have tried:
Write the content in the NAME of the file:
File file = new java.io.File(".1234567890"); file.createNewFile();
Write the file Using FileOutputStream;
fd = new FileOutputStream(".flush", false); fd.write(1234567890); fd.flush(); fd.getFD().sync(); fd.close();
I know the target machine is really bad, but i'm trying to optimize this. Any advice?