This entire method is overly complicated.  It can be written just fine as:

  public OutputStream getOutputStream(boolean append) throws IOException {
    return new FileOutputStream(getLocalFile(), append);
  }