mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
24.07.2007 cb3a76a157589591106fdc50895a1d987ca25483
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -430,6 +430,21 @@
  }
  /**
   * Creates the parent directory if it does not already exist.
   * @param f File for which parentage will be insured
   * @return boolean indicating whether or not the input <code>f</code>
   * has a parent after this method is invoked.
   */
  static public boolean insureParentsExist(File f) {
    File parent = f.getParentFile();
    boolean b = parent.exists();
    if (!b) {
      b = parent.mkdirs();
    }
    return b;
  }
  /**
   * Returns <CODE>true</CODE> if we can write on the provided path and
   * <CODE>false</CODE> otherwise.
   * @param path the path.
@@ -464,10 +479,20 @@
   * was a directory) and <CODE>false</CODE> otherwise.
   * @throws IOException if something goes wrong.
   */
  public static boolean createDirectory(String path) throws IOException
  public static boolean createDirectory(String path) throws IOException {
    return createDirectory(new File(path));
  }
  /**
   * Creates the a directory in the provided path.
   * @param f the path.
   * @return <CODE>true</CODE> if the path was created or already existed (and
   * was a directory) and <CODE>false</CODE> otherwise.
   * @throws IOException if something goes wrong.
   */
  public static boolean createDirectory(File f) throws IOException
  {
    boolean directoryCreated;
    File f = new File(path);
    if (!f.exists())
    {
      directoryCreated = f.mkdirs();
@@ -485,7 +510,20 @@
   * @param is the InputStream with the contents of the file.
   * @throws IOException if something goes wrong.
   */
  public static void createFile(String path, InputStream is) throws IOException
  public static void createFile(String path, InputStream is)
          throws IOException
  {
    createFile(new File(path), is);
  }
  /**
   * Creates a file on the specified path with the contents of the provided
   * stream.
   * @param path the path where the file will be created.
   * @param is the InputStream with the contents of the file.
   * @throws IOException if something goes wrong.
   */
  public static void createFile(File path, InputStream is) throws IOException
  {
    FileOutputStream out;
    BufferedOutputStream dest;