當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。