Happy Torturer Happy Torturer - 5 months ago 44
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

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

Reference: