Happy Torturer Happy Torturer - 1 year ago 127
Android Question

openFileOutput() method vs FileOutputStream() constructor

Why in Android one should use

openFileOutput()
method instead of
FileOutputStream()
constructor?

Would the mode type as a second param of openFileOutput() be the only "respectful" reason for all the cases?

FileOutputStream fos;
fos = openFileOutput("test.txt", Context.MODE_PRIVATE);
fos = new FileOutputStream("test.txt");

Answer Source

Another difference is that openFileOutputStream opens / creates a file in the the device's "internal" storage.

Reference: