title: FileWriter vs FileOutputStream in Java
body: <p>I'm little confused about <code>FileWriter</code> and <code>FileOutputStream</code>. As I see <a href="http://ktutorials.com/source/OpenJDK/java/io/FileWriter.java" rel="noreferrer">source code of FileWriter</a> there are just 4 constructors and each constructor is calling <code>FileOutputStream</code>'s constructor. </p>
  
  <pre><code>public FileWriter(String fileName) throws IOException {
         super(new FileOutputStream(fileName));
  }
  public FileWriter(String fileName, boolean append) throws IOException {
          super(new FileOutputStream(fileName, append));
  }
  public FileWriter(File file) throws IOException {
          super(new FileOutputStream(file));
  }
  public FileWriter(File file, boolean append) throws IOException {
          super(new FileOutputStream(file, append));
  }
  public FileWriter(FileDescriptor fd) {
          super(new FileOutputStream(fd));
  }
  </code></pre>
  
  <p>After searching difference between them I found <a href="http://www.programcreek.com/2011/03/fileoutputstream-vs-filewriter/" rel="noreferrer">mentioned here</a>.</p>
  
  <blockquote>
    <p>FileOutputStream is meant for writing streams of raw bytes such as
    image data. For writing streams of characters, consider using
    FileWriter.</p>
  </blockquote>
  
  <p>How <code>FileWriter</code> can make difference? Even it still calling <code>FileOutputStream</code>'s constructor without any changing.</p>