Android: Difference between FileOutputStream and FileWriter

android, file-io, java

Solution

If I remember correctly, FileOutputStream is more general purpose - it can be used for binary data or text data. FileWriter is used for text only.

http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileWriter.html

FileWriter is meant for writing streams of characters. For writing streams of raw bytes, consider using a FileOutputStream.

Problem

I was wondering what the exact difference is between Android's FileOutputStream and FileWriter class. When would it be most appropriate to use each one?

Original source