org.eclipse.jdt.internal.compiler.util.Util.isJrt()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(239)

本文整理了Java中org.eclipse.jdt.internal.compiler.util.Util.isJrt()方法的一些代码示例,展示了Util.isJrt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isJrt()方法的具体详情如下:
包路径:org.eclipse.jdt.internal.compiler.util.Util
类名称:Util
方法名:isJrt

Util.isJrt介绍

[英]Returns true iff str.toLowerCase().endsWith("jrt-fs.jar") implementation is not creating extra strings.
[中]返回true iff str.toLowerCase()。endsWith(“jrt fs.jar”)实现没有创建额外的字符串。

代码示例

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

static ClasspathLocation forLibrary(String libraryPathname, 
                    long lastModified, 
                    AccessRuleSet accessRuleSet, 
                    IPath annotationsPath,
                    boolean autoModule) {
  return Util.isJrt(libraryPathname) ?
      new ClasspathJrt(libraryPathname, annotationsPath) :
        Util.archiveFormat(libraryPathname) == Util.JMOD_FILE ?
          new ClasspathJMod(libraryPathname, lastModified, accessRuleSet, annotationsPath) :
      new ClasspathJar(libraryPathname, lastModified, accessRuleSet, annotationsPath, autoModule);

}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

String jarPath = in.readUTF();
  newState.binaryLocations[i] = ClasspathLocation.forLibrary(jarPath, in.readLong(),
        readRestriction(in), new Path(in.readUTF()), Util.isJrt(jarPath) ? false : in.readBoolean());
  break;
case INTERNAL_JAR :

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

case EXTERNAL_JAR :
  String jarPath = in.readUTF();
  if (Util.isJrt(jarPath)) {
    newState.binaryLocations[i] = ClasspathLocation.forJrtSystem(jarPath, readRestriction(in), new Path(in.readUTF()), in.readUTF());
  } else {
case EXTERNAL_JAR :
  String jarPath = in.readUTF();
  if (Util.isJrt(jarPath)) {
    newState.testBinaryLocations[i] = ClasspathLocation.forJrtSystem(jarPath, readRestriction(in), new Path(in.readUTF()), in.readUTF());
  } else {

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
  module = resourcePath.substring(separatorIndex + 1, 
      (separatorIndex = resourcePath.lastIndexOf(IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR)));

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

protected byte[] getClassFileContent(JarPackageFragmentRoot root, String className) throws CoreException, IOException {
  byte[] contents = null;
  String rootPath = root.getPath().toOSString();
  if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
      try {
        contents = org.eclipse.jdt.internal.compiler.util.JRTUtil.getClassfileContent(
            new File(rootPath),
            className,
            root.getElementName());
      } catch (ClassFormatException e) {
        e.printStackTrace();
      }
  } else {
    ZipFile zip = root.getJar();
    try {
      ZipEntry ze = zip.getEntry(className);
      if (ze != null) {
        contents = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip);
      }
    } finally {
      JavaModelManager.getJavaModelManager().closeZipFile(zip);
    }
  }
  if (contents == null && Thread.interrupted()) // reading from JRT is interruptible
    throw new OperationCanceledException();
  return contents;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
  module = resourcePath.substring(separatorIndex + 1, 
      (separatorIndex = resourcePath.lastIndexOf(IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR)));

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

if (Util.isJrt(pkgFragmentRootPath.toOSString())) {
  try {
    JrtPackageNamesAdderVisitor jrtPackageNamesAdderVisitor = new JrtPackageNamesAdderVisitor(firstLevelPackageNames,

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

if (Util.isJrt(pkgFragmentRootPath.toOSString())) {
  try {
    JrtPackageNamesAdderVisitor jrtPackageNamesAdderVisitor = new JrtPackageNamesAdderVisitor(firstLevelPackageNames,

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

protected byte[] getClassFileContent(JarPackageFragmentRoot root, String className) throws CoreException, IOException {
  byte[] contents = null;
  String rootPath = root.getPath().toOSString();
  if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
      try {
        contents = org.eclipse.jdt.internal.compiler.util.JRTUtil.getClassfileContent(
            new File(rootPath),
            className,
            root.getElementName());
      } catch (ClassFormatException e) {
        e.printStackTrace();
      }
  } else {
    ZipFile zip = root.getJar();
    try {
      ZipEntry ze = zip.getEntry(className);
      if (ze != null) {
        contents = org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip);
      }
    } finally {
      JavaModelManager.getJavaModelManager().closeZipFile(zip);
    }
  }
  return contents;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public InputStream getContents() throws CoreException {
  IPackageFragmentRoot root = getPackageFragmentRoot();
  if (Util.isJrt(root.getPath().toOSString())) {
    try {
      IPath rootPath = root.getPath();

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
public InputStream getContents() throws CoreException {
  IPackageFragmentRoot root = getPackageFragmentRoot();
  if (Util.isJrt(root.getPath().toOSString())) {
    try {
      IPath rootPath = root.getPath();

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

String rootPath = root.getPath().toOSString();
String rootIdentifier = root.getHandleIdentifier();
if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
  int slash = rootIdentifier.lastIndexOf('/');
  if (slash != -1)

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * @see JavaElement#getHandleMemento(StringBuffer)
 */
@Override
protected void getHandleMemento(StringBuffer buff) {
  IPath path;
  IResource underlyingResource = getResource();
  if (underlyingResource != null) {
    // internal jar or regular root
    if (resource().getProject().equals(getJavaProject().getProject())) {
      path = underlyingResource.getProjectRelativePath();
    } else {
      path = underlyingResource.getFullPath();
    }
  } else {
    // external jar
    path = getPath();
  }
  ((JavaElement)getParent()).getHandleMemento(buff);
  buff.append(getHandleMementoDelimiter());
  escapeMementoName(buff, path.toString());
  if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(path.toOSString())) {
    buff.append(JavaElement.JEM_MODULE);
    escapeMementoName(buff, getElementName());
  }
}
/**

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * @see JavaElement#getHandleMemento(StringBuffer)
 */
protected void getHandleMemento(StringBuffer buff) {
  IPath path;
  IResource underlyingResource = getResource();
  if (underlyingResource != null) {
    // internal jar or regular root
    if (resource().getProject().equals(getJavaProject().getProject())) {
      path = underlyingResource.getProjectRelativePath();
    } else {
      path = underlyingResource.getFullPath();
    }
  } else {
    // external jar
    path = getPath();
  }
  ((JavaElement)getParent()).getHandleMemento(buff);
  buff.append(getHandleMementoDelimiter());
  escapeMementoName(buff, path.toString());
  if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(path.toOSString())) {
    buff.append(getHandleMementoDelimiter());
    escapeMementoName(buff, getElementName());
  }
}
/**

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

ClasspathLocation bLocation = null;
String libPath = path.toOSString();
if (Util.isJrt(libPath)) {
  bLocation = ClasspathLocation.forJrtSystem(path.toOSString(), accessRuleSet, externalAnnotationPath, release);
} else {

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
  String classFileName = classFile.getElementName();
  String path = Util.concatWith(pkg.names, classFileName, '/');

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
  String classFileName = classFile.getElementName();
  String path = Util.concatWith(pkg.names, classFileName, '/');

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

String rootPath = root.getPath().toOSString();
String rootIdentifier = root.getHandleIdentifier();
if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
  int slash = rootIdentifier.lastIndexOf('/');
  if (slash != -1)

相关文章