Android FileIO with Android Writing raw array of bytes

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

  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.



Got any Android Question?