本文整理匯總了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;
}