本文整理汇总了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();
}
};
}
示例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;
}
示例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;
}
示例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;
}