src/common/Explorer.java

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package common;

import java.io.File;

public class Explorer {
	/**
	 * 锟侥硷拷锟角凤拷锟斤拷锟?
	 * 
	 * @param file
	 * @return
	 */
	public static boolean existsFile(String file) {
		return new File(file).exists();
	}

	/**
	 * 
	 * @param file
	 */
	public static void existsAndCreateParent(String file) {
		File aFile = new File(file).getParentFile();
		if (!aFile.exists()) {
			aFile.mkdirs();
		}
	}

	/**
	 * 锟斤拷b目录
	 * 
	 * @param file
	 */
	public static void existsAndCreateSelf(String file) {
		File aFile = new File(file);
		if (!aFile.exists()) {
			aFile.mkdirs();
		}
	}

	/**
	 * 锟睫革拷锟斤拷锟?
	 * 
	 * @param source
	 * @param destination
	 * @return
	 */
	public static boolean renameTo(String source, String destination) {
		File sourceFile = new File(source);
		return sourceFile.renameTo(new File(destination));
	}

	public static void main(String[] args) {
		File file = new File(
				"E:\\work\\mewoo\\uploadFile\\user\\sample\\1\\1_D8D4146C7C35319D4C74B16B39EAEFAB.jpg");
		File file1 = new File(
				"E:\\work\\mewoo\\uploadFile\\user\\sample\\1\\xiaoming.jpg");
		if(file1.exists()){
			file1.delete();
		}
		file.renameTo(file1);
	}
后面还有 11 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。