title: Why AccessDeniedException is raising when using just created folder?
body: <p>I'm creating simple object serialization, and creation of <strong>BufferedOutputStream</strong> is raising an exception <strong>AccessDeniedException</strong>. Here is the code:</p>
  
  <pre><code>Path filePath = Paths.get("c:\\temp\\");
  File xmlFile = new File("c:\\temp\\");
  boolean success = xmlFile.mkdirs();
  if (!success &amp;&amp; ! xmlFile.exists() ) {
      // Directory creation failed
      System.out.println("Failed to create a file: " + filePath);
  }
  
  try (
      ObjectOutputStream objectOut = new ObjectOutputStream(
          new BufferedOutputStream(Files.newOutputStream(filePath, StandardOpenOption.WRITE)))){
      // Write three objects to the fi le
      objectOut.writeObject(solarSystem); // Write object
  
      System.out.println("Serialized: " + solarSystem);
  } catch(IOException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>But directory is empty and if it doesn't not exist, it's created...</p>