Code example for File

Methods: exists, getName, getParentFile, getPath

0
	/** 
	 * Reads a patch from a file. 
	 *  
	 * @param file 
	 * @return an integer handle that identifies this patch; this handle is the 
	 *         $0 value of the patch 
	 * @throws IOException 
	 *             thrown if the file doesn't exist or can't be opened 
	 */ 
	public synchronized static int openPatch(File file) throws IOException {
		if (!file.exists()) {
			throw new FileNotFoundException(file.getPath());
		} 
		String name = file.getName();
		File dir = file.getParentFile();
		long ptr = openFile(name, (dir != null) ? dir.getAbsolutePath() : ".");
		if (ptr == 0) {
			throw new IOException("unable to open patch " + file.getPath());
		} 
		int handle = getDollarZero(ptr);
		patches.put(handle, ptr);