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


Java EncodingManager.getDefaultCharset方法代码示例

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


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

示例1: getCharset

import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
public Charset getCharset(Project project) {
  // try to find existing virtual file
  VirtualFile virtualFile = getVirtualFile();
  VirtualFile existing = virtualFile != null && virtualFile.isValid() ? virtualFile : null;
  if (existing == null) {
    LocalFileSystem lfs = LocalFileSystem.getInstance();
    for (File f = myFile; f != null; f = f.getParentFile()) {
      existing = lfs.findFileByIoFile(f);
      if (existing != null && existing.isValid()) {
        break;
      }
    }
  }
  if (existing != null) {
    Charset rc = existing.getCharset();
    if (rc != null) {
      return rc;
    }
  }
  EncodingManager e = project != null ? EncodingProjectManager.getInstance(project) : null;
  if (e == null) {
    e = EncodingManager.getInstance();
  }
  return e.getDefaultCharset();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:FilePathImpl.java

示例2: getCharset

import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
public Charset getCharset(Project project) {
  // try to find existing virtual file
  VirtualFile existing = myVirtualFile != null && myVirtualFile.isValid() ? myVirtualFile : null;
  if (existing == null) {
    LocalFileSystem lfs = LocalFileSystem.getInstance();
    for (File f = myFile; f != null; f = f.getParentFile()) {
      existing = lfs.findFileByIoFile(f);
      if (existing != null && existing.isValid()) {
        break;
      }
    }
  }
  if (existing != null) {
    Charset rc = existing.getCharset();
    if (rc != null) {
      return rc;
    }
  }
  EncodingManager e = project != null ? EncodingProjectManager.getInstance(project) : null;
  if (e == null) {
    e = EncodingManager.getInstance();
  }
  return e.getDefaultCharset();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:FilePathImpl.java

示例3: getCharset

import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
@NotNull
public Charset getCharset(@Nullable Project project) {
  VirtualFile file = getVirtualFile();
  String path = myPath;
  while ((file == null || !file.isValid()) && !path.isEmpty()) {
    path = PathUtil.getParentPath(path);
    file = LocalFileSystem.getInstance().findFileByPath(path);
  }
  if (file != null) {
    return file.getCharset();
  }
  EncodingManager e = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
  return e.getDefaultCharset();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:LocalFilePath.java

示例4: getCharset

import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Override
@Nonnull
public Charset getCharset(@Nullable Project project) {
  VirtualFile file = getVirtualFile();
  String path = myPath;
  while ((file == null || !file.isValid()) && !path.isEmpty()) {
    path = PathUtil.getParentPath(path);
    file = LocalFileSystem.getInstance().findFileByPath(path);
  }
  if (file != null) {
    return file.getCharset();
  }
  EncodingManager e = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
  return e.getDefaultCharset();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:LocalFilePath.java

示例5: getCharset

import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@NotNull
@Override
public Charset getCharset(@Nullable Project project) {
  EncodingManager em = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
  return em.getDefaultCharset();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:RemoteFilePath.java

示例6: getCharset

import com.intellij.openapi.vfs.encoding.EncodingManager; //导入方法依赖的package包/类
@Nonnull
@Override
public Charset getCharset(@Nullable Project project) {
  EncodingManager em = project == null ? EncodingManager.getInstance() : EncodingProjectManager.getInstance(project);
  return em.getDefaultCharset();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:RemoteFilePath.java


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