
com.star.io.resource.FileResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utils Show documentation
Show all versions of utils Show documentation
some utility class for java develop
The newest version!
package com.star.io.resource;
import com.star.net.URLUtil;
import java.io.File;
import java.nio.file.Paths;
/**
* 文件资源访问对象
*
* @author looly
*/
public class FileResource extends UrlResource {
// ----------------------------------------------------------------------- Constructor start
/**
* 构造
*
* @param file 文件
*/
public FileResource(File file) {
super(URLUtil.getURL(file));
}
/**
* 构造
*
* @param path 文件绝对路径或相对ClassPath路径,但是这个路径不能指向一个jar包中的文件
*/
public FileResource(String path) {
this(Paths.get(path).toFile());
}
// ----------------------------------------------------------------------- Constructor end
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy