当前位置: 首页>>代码示例>>Java>>正文


Java FileUtil.unquote方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.unquote方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.unquote方法的具体用法?Java FileUtil.unquote怎么用?Java FileUtil.unquote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.io.FileUtil的用法示例。


在下文中一共展示了FileUtil.unquote方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openJarStream

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
private static InputStream openJarStream(@NotNull URL url) throws IOException {
  Pair<String, String> paths = splitJarUrl(url.getFile());
  if (paths == null) {
    throw new MalformedURLException(url.getFile());
  }

  @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") final ZipFile zipFile = new ZipFile(FileUtil.unquote(paths.first));
  ZipEntry zipEntry = zipFile.getEntry(paths.second);
  if (zipEntry == null) {
    zipFile.close();
    throw new FileNotFoundException("Entry " + paths.second + " not found in " + paths.first);
  }

  return new FilterInputStream(zipFile.getInputStream(zipEntry)) {
    @Override
    public void close() throws IOException {
      super.close();
      zipFile.close();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:URLUtil.java

示例2: getChildPathsFromFile

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static List<String> getChildPathsFromFile(URL root) {
  final List<String> paths = new ArrayList<String>();
  final File rootFile = new File(FileUtil.unquote(root.getPath()));
  new Object() {
    void collectFiles(File fromFile, String prefix) {
      final File[] list = fromFile.listFiles();
      if (list != null) {
        for (File file : list) {
          final String childRelativePath = prefix.length() == 0 ? file.getName() : prefix + URL_PATH_SEPARATOR + file.getName();
          if (file.isDirectory()) {
            collectFiles(file, childRelativePath);
          }
          else {
            paths.add(childRelativePath);
          }
        }
      }
    }
  }.collectFiles(rootFile, "");
  return paths;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:UrlUtil.java

示例3: getResourceUrl

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
String getResourceUrl() {
  String resolvedResourcePath = myResolvedResourcePath;
  if (resolvedResourcePath != null) return resolvedResourcePath;

  final URL resource = myClass == null ? myClassLoader.getResource(myFile) : myClass.getResource(myFile);

  if (resource == null) {
    String message = "Cannot find standard resource. filename:" + myFile + " class=" + myClass + ", classLoader:" + myClassLoader;
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      LOG.error(message);
    }
    else {
      LOG.warn(message);
    }

    myResolvedResourcePath = null;
    return null;
  }

  String path = FileUtil.unquote(resource.toString());
  // this is done by FileUtil for windows
  path = path.replace('\\','/');
  myResolvedResourcePath = path;
  return path;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ExternalResourceManagerExImpl.java

示例4: FileLoader

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
FileLoader(URL url, int index, boolean canHavePersistentIndex) throws IOException {
  super(url, index);
  myRootDir = new File(FileUtil.unquote(url.getFile()));
  myRootDirAbsolutePath = myRootDir.getAbsolutePath();
  myCanHavePersistentIndex = canHavePersistentIndex;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:FileLoader.java


注:本文中的com.intellij.openapi.util.io.FileUtil.unquote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。