Java 1.8 FileOutputStream Creating a Directory
<p>I seem to be having a problem with the 1.8 JDK this project was built using the 1.7 JDK but i'm having a problem i can't quite understand.</p>

<p>So i have a ConfigReader Class.</p>

<pre><code>    public class ConfigReader {
    private static ConfigReader _inst;

    public static ConfigReader GetInstance(){
        if(_inst == null){
            _inst = new ConfigReader();
        }
        return _inst;
    }

    private String basePath =  "Config/";

    public &lt;T extends Serializable&gt; void Write(T in, String filename)
    {
        String path = basePath+filename+".bin";
        try
        {   
            File f = new File(path);
            f.mkdirs();
            FileOutputStream fileOut =
            new FileOutputStream(path);
            ObjectOutputStream out = new ObjectOutputStream(fileOut);
            out.writeObject(in);
            out.close();
            fileOut.close();
            System.out.println("Saved config file '"+path+"'");
        }catch(IOException i)
        {
            System.out.println("Failed to create config file '"+path+"'");
        }
    }

    public boolean ConfigExists(String filename)
    {
        String path = basePath+filename+".bin";
        File finfo = new File(path);
        return finfo.exists();
    }

    public &lt;T extends Serializable&gt; T Read(T readin, String filename)
    {
        String path = basePath+filename+".bin";
        try
        {
            FileInputStream fileIn = new FileInputStream(path);
            ObjectInputStream in = new ObjectInputStream(fileIn);
            readin = (T) in.readObject();
            in.close();
            fileIn.close();
            return readin;
        }catch(IOException i)
        {
            System.out.println("Failed to read '"+path+"'");
            return null;
        }catch(ClassNotFoundException c)
        {
            System.out.println("Failed to unserialize '"+path+"'");
            c.printStackTrace();
            return null;
        }
    }
}
</code></pre>

<p>But for some reason when the Write Method is called it's creating directories E.G </p>

<p>Reading a file:</p>

<pre><code>boolean cfgExists = ConfigReader.GetInstance().ConfigExists("Global.cfg");
if(_inst == null &amp;&amp; !cfgExists){
    _inst = new Global();
}else if(cfgExists){
    _inst = ConfigReader.GetInstance().Read(_inst, "Global.cfg");
}
</code></pre>

<p>Writing a file:</p>

<pre><code>ConfigReader.GetInstance().Write(this, "Global.cfg");
</code></pre>

<p>I end up with the empty directory "Global.cfg.bin" not a file. i'm slightly confused why this is now happening...</p>