Writing raw array of bytes
suggest changeFile myFile = new File(getFilesDir(), "myData.bin");
FileOutputStream out = new FileOutputStream(myFile);
// Write four bytes one two three four:
out.write(new byte[] { 1, 2, 3, 4 });
out.close();
There is nothing Android-specific in this code. If you write lots of small values often, use BufferedOutputStream to reduce wear on the device's flash storage.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents