jodd.io.FileUtil.toFile()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(212)

本文整理了Java中jodd.io.FileUtil.toFile()方法的一些代码示例,展示了FileUtil.toFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.toFile()方法的具体详情如下:
包路径:jodd.io.FileUtil
类名称:FileUtil
方法名:toFile

FileUtil.toFile介绍

[英]Converts file URLs to file. Ignores other schemes and returns null.
[中]将文件URL转换为文件URL。忽略其他方案并返回null

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Returns a file of either a folder or a containing archive.
 */
public static File toContainerFile(URL url) {
  String protocol = url.getProtocol();
  if (protocol.equals("file")) {
    return toFile(url);
  }
  String path = url.getPath();
  return new File(URI.create(
      path.substring(0, path.lastIndexOf("!/"))));
}

代码示例来源:origin: oblac/jodd

/**
 * Returns a file of either a folder or a containing archive.
 */
public static File toContainerFile(final URL url) {
  String protocol = url.getProtocol();
  if (protocol.equals(FILE_PROTOCOL)) {
    return toFile(url);
  }
  String path = url.getPath();
  return new File(URI.create(
    path.substring(ZERO, path.lastIndexOf("!/"))));
}

代码示例来源:origin: redisson/redisson

/**
 * Specifies the search path. Throws an exception if URL is invalid.
 */
public T searchPath(URL searchPath) {
  File file = FileUtil.toFile(searchPath);
  if (file == null) {
    throw new FindFileException("URL error: " + searchPath);
  }
  addPath(file);
  return (T) this;
}

代码示例来源:origin: redisson/redisson

/**
 * Scans single URL for classes and jar files.
 * Callback {@link #onEntry(EntryData)} is called on
 * each class name.
 */
protected void scanUrl(URL url) {
  File file = FileUtil.toFile(url);
  if (file == null) {
    if (!ignoreException) {
      throw new FindFileException("URL is not a valid file: " + url);
    }
  }
  scanPath(file);
}

代码示例来源:origin: redisson/redisson

URL[] urls = ((URLClassLoader) classLoader).getURLs();
for (URL u : urls) {
  File f = FileUtil.toFile(u);
  if ((f != null) && f.exists()) {
    try {

代码示例来源:origin: oblac/jodd

File webXmlFile = FileUtil.toFile(webXmlUrl);
File echoServletFile = FileUtil.toFile(echoServletUrl);
FileUtil.copyFileToDir(echoServletFile, classes);
echoServletFile = FileUtil.toFile(echoServletUrl);
FileUtil.copyFileToDir(echoServletFile, classes);
echoServletFile = FileUtil.toFile(echoServletUrl);
FileUtil.copyFileToDir(echoServletFile, classes);
File redirectServletFile = FileUtil.toFile(redirectServletUrl);
FileUtil.copyFileToDir(redirectServletFile, classes);
File targetServletFile = FileUtil.toFile(targetServletUrl);
FileUtil.copyFileToDir(targetServletFile, classes);

代码示例来源:origin: org.jodd/jodd-core

/**
 * Returns a file of either a folder or a containing archive.
 */
public static File toContainerFile(final URL url) {
  String protocol = url.getProtocol();
  if (protocol.equals(FILE_PROTOCOL)) {
    return toFile(url);
  }
  String path = url.getPath();
  return new File(URI.create(
    path.substring(ZERO, path.lastIndexOf("!/"))));
}

相关文章