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


Java RelativeFile类代码示例

本文整理汇总了Java中com.sun.tools.javac.file.RelativePath.RelativeFile的典型用法代码示例。如果您正苦于以下问题:Java RelativeFile类的具体用法?Java RelativeFile怎么用?Java RelativeFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RelativeFile类属于com.sun.tools.javac.file.RelativePath包,在下文中一共展示了RelativeFile类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: length

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
public synchronized int length(RelativeFile path) throws IOException {
    Entry entry = getZipIndexEntry(path);
    if (entry == null)
        throw new FileNotFoundException();

    if (entry.isDir) {
        return 0;
    }

    byte[] header = getHeader(entry);
    // entry is not compressed?
    if (get2ByteLittleEndian(header, 8) == 0) {
        return entry.compressedSize;
    } else {
        return entry.size;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:18,代码来源:ZipFileIndex.java

示例2: getFileForInput

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
private JavaFileObject getFileForInput(Location location, RelativeFile name) throws IOException {
    Iterable<? extends File> path = getLocation(location);
    if (path == null)
        return null;

    for (File dir : path) {
        Archive a = archives.get(dir);
        if (a == null) {
            if (fsInfo.isDirectory(dir)) {
                File f = name.getFile(dir);
                if (f.exists())
                    return new RegularFileObject(this, f);
                continue;
            }
            // Not a directory, create the archive
            a = openArchive(dir);
        }
        // Process the archive
        if (a.contains(name)) {
            return a.getFileObject(name.dirname(), name.basename());
        }
    }
    return null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:JavacFileManager.java

示例3: getFileForInput

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
private JavaFileObject getFileForInput(Location location, RelativeFile name) throws IOException {
    Iterable<? extends File> path = getLocation(location);
    if (path == null)
        return null;

    for (File dir: path) {
        Archive a = archives.get(dir);
        if (a == null) {
            if (fsInfo.isDirectory(dir)) {
                File f = name.getFile(dir);
                if (f.exists())
                    return new RegularFileObject(this, f);
                continue;
            }
            // Not a directory, create the archive
            a = openArchive(dir);
        }
        // Process the archive
        if (a.contains(name)) {
            return a.getFileObject(name.dirname(), name.basename());
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:JavacFileManager.java

示例4: getFileForOutput

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
public FileObject getFileForOutput(Location location,
                                   String packageName,
                                   String relativeName,
                                   FileObject sibling)
    throws IOException
{
    nullCheck(location);
    // validatePackageName(packageName);
    nullCheck(packageName);
    if (!isRelativeUri(relativeName))
        throw new IllegalArgumentException("Invalid relative name: " + relativeName);
    RelativeFile name = packageName.length() == 0
        ? new RelativeFile(relativeName)
        : new RelativeFile(RelativeDirectory.forPackage(packageName), relativeName);
    return getFileForOutput(location, name, sibling);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:JavacFileManager.java

示例5: getFileForInput

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER)
public FileObject getFileForInput(Location location,
                                  String packageName,
                                  String relativeName)
    throws IOException
{
    checkNotModuleOrientedLocation(location);
    // validatePackageName(packageName);
    nullCheck(packageName);
    if (!isRelativeUri(relativeName))
        throw new IllegalArgumentException("Invalid relative name: " + relativeName);
    RelativeFile name = packageName.length() == 0
        ? new RelativeFile(relativeName)
        : new RelativeFile(RelativeDirectory.forPackage(packageName), relativeName);
    return getFileForInput(location, name);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:JavacFileManager.java

示例6: getFileForOutput

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER)
public FileObject getFileForOutput(Location location,
                                   String packageName,
                                   String relativeName,
                                   FileObject sibling)
    throws IOException
{
    checkOutputLocation(location);
    // validatePackageName(packageName);
    nullCheck(packageName);
    if (!isRelativeUri(relativeName))
        throw new IllegalArgumentException("Invalid relative name: " + relativeName);
    RelativeFile name = packageName.length() == 0
        ? new RelativeFile(relativeName)
        : new RelativeFile(RelativeDirectory.forPackage(packageName), relativeName);
    return getFileForOutput(location, name, sibling);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:JavacFileManager.java

示例7: run

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
void run() throws Exception {
    RelativeFile TEST_ENTRY_NAME = new RelativeFile("java/lang/String.class");

    File testJar = createJar("test.jar", "java.lang.*");

    try (JarFile j = new JarFile(testJar)) {
        JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
        long jarEntryTime = je.getTime();

        Context context = new Context();
        JavacFileManager fm = new JavacFileManager(context, false, null);
        fm.setLocation(StandardLocation.CLASS_PATH, Collections.singletonList(testJar));
        FileObject fo =
            fm.getFileForInput(StandardLocation.CLASS_PATH, "", TEST_ENTRY_NAME.getPath());
        long jfoTime = fo.getLastModified();

        check(je, jarEntryTime, fo, jfoTime);

        if (errors > 0)
            throw new Exception(errors + " occurred");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:T6725036.java

示例8: getFileForInput

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER)
public FileObject getFileForInput(Location location,
                                  String packageName,
                                  String relativeName)
    throws IOException
{
    nullCheck(location);
    // validatePackageName(packageName);
    nullCheck(packageName);
    if (!isRelativeUri(relativeName))
        throw new IllegalArgumentException("Invalid relative name: " + relativeName);
    RelativeFile name = packageName.length() == 0
        ? new RelativeFile(relativeName)
        : new RelativeFile(RelativeDirectory.forPackage(packageName), relativeName);
    return getFileForInput(location, name);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:17,代码来源:JavacFileManager.java

示例9: getFileForOutput

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER)
public FileObject getFileForOutput(Location location,
                                   String packageName,
                                   String relativeName,
                                   FileObject sibling)
    throws IOException
{
    nullCheck(location);
    // validatePackageName(packageName);
    nullCheck(packageName);
    if (!isRelativeUri(relativeName))
        throw new IllegalArgumentException("Invalid relative name: " + relativeName);
    RelativeFile name = packageName.length() == 0
        ? new RelativeFile(relativeName)
        : new RelativeFile(RelativeDirectory.forPackage(packageName), relativeName);
    return getFileForOutput(location, name, sibling);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:18,代码来源:JavacFileManager.java

示例10: length

import com.sun.tools.javac.file.RelativePath.RelativeFile; //导入依赖的package包/类
public int length(RelativeFile path) throws IOException {
    lock.lock();
    try {
        Entry entry = getZipIndexEntry(path);
        if (entry == null)
            throw new FileNotFoundException();

        if (entry.isDir) {
            return 0;
        }

        byte[] header = getHeader(entry);
        // entry is not compressed?
        if (get2ByteLittleEndian(header, 8) == 0) {
            return entry.compressedSize;
        } else {
            return entry.size;
        }
    }
    finally {
        lock.unlock();
    }
}
 
开发者ID:lucasicf,项目名称:metricgenerator-jdk-compiler,代码行数:24,代码来源:ZipFileIndex.java


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