title: java.io.FileNotFoundException: (Is a directory)
body: <pre><code>if (ContextCompat.checkSelfPermission(MainActivity.getAppContext(),
                  Manifest.permission.WRITE_EXTERNAL_STORAGE)
                  != PackageManager.PERMISSION_GRANTED) {
              Toast.makeText(MainActivity.getAppContext(), "permission denied, please enable it", Toast.LENGTH_SHORT).show();
          } else{
              Toast.makeText(MainActivity.getAppContext(), "permission granted", Toast.LENGTH_SHORT).show();
          }
  
  
          if (!mydir.exists()) {
              mydir.mkdirs();
              if (!mydir.mkdirs()) {
                  Toast.makeText(MainActivity.getAppContext(), "dir not made", Toast.LENGTH_SHORT).show();
              }
          }
  
          File file = new File(mydir, fname);
          String s = file.getPath().toString();
          Toast.makeText(MainActivity.getAppContext(), s, Toast.LENGTH_SHORT).show();
  
          FileOutputStream fos = new FileOutputStream(file); //error appears here
          ObjectOutputStream oos = new ObjectOutputStream(fos);
          oos.writeObject(this);
          oos.close();
          fos.close();
  </code></pre>
  
  <p>I get the following error, I have manually enabled the permission for the app: </p>
  
  <p>java.io.FileNotFoundException: /storage/emulated/0/iCHMF/elasticDefault.dat (Is a directory)</p>
  
  <p>fname is the file i want to output "/elasticDefault.dat"
  problematic code line is here.  </p>
  
  <pre><code>FileOutputStream fos = new FileOutputStream(file)
  </code></pre>