code: public static File createDirectoryTree( File file ) throws IOException
      {
          if (file.isDirectory() && file.canWrite()) return file;
          if (file.isDirectory())
              throw new IOException( "Directory not writable " + file.getAbsolutePath() );
          if (file.exists())
              throw new IOException( file.getAbsolutePath() + " is not a directory" );
          boolean created = file.mkdirs();
          if (!created) throw new IOException( "Could not create directory " + file.getAbsolutePath() );
  
          return file;
      }
docs: <p>createDirectoryTree.</p>
  
  @param file a {@link java.io.File} object.
  @return a {@link java.io.File} object.
  @throws java.io.IOException if any.