Given a file, returns a File representing a sibling directory with the specified name.

@param f              If f is the filesystem root, a runtime exeption will be thrown.
@param siblingDirName The non-empty name of the sibling directory.
485652
public static File siblingDirectory(final File f, final String siblingDirName) {
    checkNotNull(f);
    checkNotNull(siblingDirName);
    checkArgument(!siblingDirName.isEmpty());

    final File parent = f.getParentFile();
    if (parent != null) {
      return new File(parent, siblingDirName);
    } else {
      throw new RuntimeException(String
          .format("Cannot create sibling directory %s of %s because the latter has no parent.",
              siblingDirName, f));
    }
  }
286610
public static Path pathForFileInRoot(
            final File rootDir,
            final File file
    )
    {
        String filePath = file.getAbsolutePath();
        String rootPath = rootDir.getAbsolutePath();
        if (!filePath.startsWith(rootPath)) {
            throw new IllegalArgumentException("not a file in the root directory: " + file);
        }
        return pathForRelativeFilepath(filePath.substring(rootPath.length()));
    }
895287
public static void createParentDirectoryIfNecessary(final File file) {
        final File parentDirectory = file.getParentFile();
        if (parentDirectory == null || parentDirectory.mkdirs() || parentDirectory.exists()) {
            return;
	}
        throw new SdkClientException("Unable to create directory in the path: " + parentDirectory.getAbsolutePath());
    }
533553
public File createFile(File dir, String filename) throws DataUtilException {
        if(dir == null) {
            throw new DataUtilException("The directory parameter can't be a null value");
        }
        try {
            File file = new File(dir, filename);
            return createFile(file);
        } catch (Exception e) {
            throw new DataUtilException("Invalid file: " + filename);
        }
    }
1150468
function(name, cbfsgetchild) {
        var path = Path.join(this.path, name);

        Fs.stat(path, function(err, stat) {
            if (err || typeof stat == "undefined") {
                return cbfsgetchild(new Exc.FileNotFound("File with name "
                    + path + " could not be located"));
            }
            cbfsgetchild(null, stat.isDirectory()
                ? jsDAV_FSExt_Directory.new(path)
                : jsDAV_FSExt_File.new(path))
        });
    }
522251
public List<String> getFileLinesAsList(File f) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(
            new DataInputStream(new FileInputStream(f))));
        List<String> result = new LinkedList<String>();
        String strLine;
        while ((strLine = br.readLine()) != null) {
            result.add(strLine);
        }
        br.close();
        return result;

    }
182887
public static String computeFileRelativeLocation( File rootDirectory, File subFile ) {

		String rootPath = rootDirectory.getAbsolutePath();
		String subPath = subFile.getAbsolutePath();
		if(  ! subPath.startsWith( rootPath ))
			throw new IllegalArgumentException( "The sub-file must be contained in the directory." );

		if(  rootDirectory.equals( subFile ))
			throw new IllegalArgumentException( "The sub-file must be different than the directory." );

		return subPath.substring( rootPath.length() + 1 ).replace( '\\', '/' );
	}
457844
public static boolean fileInsideDirectory(final File dir, final File file) {
        checkNotNull("dir", dir);
        checkNotNull("file", file);

        final String dirPath = getCanonicalPath(dir);
        final String filePath = getCanonicalPath(file);
        return filePath.startsWith(dirPath);
    }
872788
public static void writeToFile(final File fileNode, final byte[] data) throws FrameworkException, IOException {

		setFileProperties(fileNode);

		FileUtils.writeByteArrayToFile(fileNode.getFileOnDisk(), data);

	}
218779
public static String getImageFilename(String strFilename, String strSubDirectory)
   {
       if ((strFilename == null) || (strFilename.length() == 0))
           return null;    // A null will tell a JButton not to load an image
       if (strFilename.indexOf('.') == -1)
           strFilename += ".gif";
       strFilename = Util.getFullFilename(strFilename, strSubDirectory, Constant.IMAGE_LOCATION, true);
       return strFilename;
   }
789344
public Nfs3SymlinkRequest makeSymlinkRequest(String symbolicLinkData, byte[] parentDirectoryFileHandle, String name,
            NfsSetAttributes attributes) throws FileNotFoundException {
        return new Nfs3SymlinkRequest(symbolicLinkData, parentDirectoryFileHandle, name, attributes, _credential);
    }
641062
public void deleteFileDelayed(final String fname) {
		_aggregator.getExecutors().getFileDeleteExecutor().schedule(new Runnable() {
			public void run() {
				File file = new File(_directory, fname);
				try {
					if (!file.delete()) {
						if (log.isLoggable(Level.WARNING)) {
							log.warning(MessageFormat.format(
									Messages.CacheManagerImpl_8,
									new Object[]{file.getAbsolutePath()}
									));
						}
					}
				} catch (Exception e) {
					if (log.isLoggable(Level.WARNING)) {
						log.log(Level.WARNING, e.getMessage(), e);
					}
				}
			}
		}, _aggregator.getOptions().getDeleteDelay(), TimeUnit.SECONDS);

	}
1060480
public void writeFile(String aFileName, String aData) throws IOException
   {
      Object lock = retrieveLock(aFileName);      
      synchronized (lock) 
      {
         IO.writeFile(aFileName, aData,IO.CHARSET);
      }

   }
2575
public static void ensureParentDirectoryExists(File f) throws IOException {
    final File parent = f.getParentFile();
    if (parent != null) {
      java.nio.file.Files.createDirectories(parent.toPath());
    }
  }
490638
public static void recursivelyDelete(File f) throws IOException {
        if (!f.exists()) {
            return;
        }
        if (f.isDirectory()) {
            for (File f1 : f.listFiles()) {
                recursivelyDelete(f1);
            }
            if (!f.delete()) {
                throw new IOException("Unable to delete directory " + f);
            }
        }
        else {
            if (!f.delete()) {
                throw new IOException("Unable to delete file " + f);
            }
        }
    }
1274277
public static void deleteFile(@Nonnull File f) throws IOException {
        newPathRemover(PathRemover.PathChecker.ALLOW_ALL).forceRemoveFile(fileToPath(f));
    }
1360619
public void fileReused(File f) {
        if (!recentFiles.contains(f)) {
            throw new IllegalStateException("Selected a recent project that doesn't exist?");
        } else {
            recentFiles.remove(f);
            recentFiles.add(f);
        }
    }