本文整理汇总了Java中com.sun.tools.javac.file.ZipFileIndexCache类的典型用法代码示例。如果您正苦于以下问题:Java ZipFileIndexCache类的具体用法?Java ZipFileIndexCache怎么用?Java ZipFileIndexCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZipFileIndexCache类属于com.sun.tools.javac.file包,在下文中一共展示了ZipFileIndexCache类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareVersionedCTSym
import com.sun.tools.javac.file.ZipFileIndexCache; //导入依赖的package包/类
Path prepareVersionedCTSym(String code7, String code8) throws Exception {
String testClasses = System.getProperty("test.classes");
Path output = Paths.get(testClasses, "test-data" + i++);
deleteRecursively(output);
Files.createDirectories(output);
Path ver7Jar = output.resolve("7.jar");
compileAndPack(output, ver7Jar, code7);
Path ver8Jar = output.resolve("8.jar");
compileAndPack(output, ver8Jar, code8);
ZipFileIndexCache.getSharedInstance().clearCache();
Path classes = output.resolve("classes");
Files.createDirectories(classes);
Path ctSym = output.resolve("ct.sym");
deleteRecursively(ctSym);
CreateSymbols.ALLOW_NON_EXISTING_CLASSES = true;
CreateSymbols.EXTENSION = ".class";
testGenerate(ver7Jar, ver8Jar, ctSym, "8", classes.toAbsolutePath().toString());
return classes;
}
示例2: run
import com.sun.tools.javac.file.ZipFileIndexCache; //导入依赖的package包/类
void run() throws Exception {
RelativeFile TEST_ENTRY_NAME = new RelativeFile("java/lang/String.class");
File f = new File(System.getProperty("java.home"));
if (!f.getName().equals("jre"))
f = new File(f, "jre");
File rt_jar = new File(new File(f, "lib"), "rt.jar");
JarFile j = new JarFile(rt_jar);
JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
long jarEntryTime = je.getTime();
ZipFileIndexCache zfic = ZipFileIndexCache.getSharedInstance();
ZipFileIndex zfi = zfic.getZipFileIndex(rt_jar, null, false, null, false);
long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);
check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);
Context context = new Context();
JavacFileManager fm = new JavacFileManager(context, false, null);
ZipFileIndexArchive zfia = new ZipFileIndexArchive(fm, zfi);
JavaFileObject jfo =
zfia.getFileObject(TEST_ENTRY_NAME.dirname(),
TEST_ENTRY_NAME.basename());
long jfoTime = jfo.getLastModified();
check(je, jarEntryTime, jfo, jfoTime);
if (errors > 0)
throw new Exception(errors + " occurred");
}