Writing raw array of bytes

suggest change
File 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 with this code. If you write lots of small values often, use BufferedOutputStream to reduce the wear of the device internal SSD.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents