本文整理汇总了Java中com.sun.tools.javac.file.RelativePath.RelativeDirectory类的典型用法代码示例。如果您正苦于以下问题:Java RelativeDirectory类的具体用法?Java RelativeDirectory怎么用?Java RelativeDirectory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RelativeDirectory类属于com.sun.tools.javac.file.RelativePath包,在下文中一共展示了RelativeDirectory类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ArchiveContainer
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
public ArchiveContainer(Path archivePath) throws IOException, ProviderNotFoundException, SecurityException {
this.archivePath = archivePath;
if (multiReleaseValue != null && archivePath.toString().endsWith(".jar")) {
Map<String,String> env = Collections.singletonMap("multi-release", multiReleaseValue);
FileSystemProvider jarFSProvider = fsInfo.getJarFSProvider();
Assert.checkNonNull(jarFSProvider, "should have been caught before!");
this.fileSystem = jarFSProvider.newFileSystem(archivePath, env);
} else {
this.fileSystem = FileSystems.newFileSystem(archivePath, null);
}
packages = new HashMap<>();
for (Path root : fileSystem.getRootDirectories()) {
Files.walkFileTree(root, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE,
new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
if (isValid(dir.getFileName())) {
packages.put(new RelativeDirectory(root.relativize(dir).toString()), dir);
return FileVisitResult.CONTINUE;
} else {
return FileVisitResult.SKIP_SUBTREE;
}
}
});
}
}
示例2: ZipFileIndex
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
boolean useCache, String cacheLocation) throws IOException {
this.zipFile = zipFile;
this.symbolFilePrefix = symbolFilePrefix;
this.symbolFilePrefixLength = (symbolFilePrefix == null ? 0 :
symbolFilePrefix.getPath().getBytes("UTF-8").length);
this.writeIndex = writeIndex;
this.usePreindexedCache = useCache;
this.preindexedCacheLocation = cacheLocation;
if (zipFile != null) {
this.zipFileLastModified = zipFile.lastModified();
}
// Validate integrity of the zip file
checkIndex();
}
示例3: getFiles
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
/**
* Returns a javac List of filenames within a directory in the ZipFileIndex.
*/
public synchronized com.sun.tools.javac.util.List<String> getFiles(RelativeDirectory path) {
try {
checkIndex();
DirectoryEntry de = directories.get(path);
com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getFiles();
if (ret == null) {
return com.sun.tools.javac.util.List.<String>nil();
}
return ret;
}
catch (IOException e) {
return com.sun.tools.javac.util.List.<String>nil();
}
}
示例4: getDirectories
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
public synchronized List<String> getDirectories(RelativeDirectory path) {
try {
checkIndex();
DirectoryEntry de = directories.get(path);
com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getDirectories();
if (ret == null) {
return com.sun.tools.javac.util.List.<String>nil();
}
return ret;
}
catch (IOException e) {
return com.sun.tools.javac.util.List.<String>nil();
}
}
示例5: list
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
public Iterable<JavaFileObject> list(Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
boolean recurse)
throws IOException {
// validatePackageName(packageName);
nullCheck(packageName);
nullCheck(kinds);
Iterable<? extends File> path = getLocation(location);
if (path == null)
return List.nil();
RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
for (File directory : path)
listContainer(directory, subdirectory, kinds, recurse, results);
return results.toList();
}
示例6: addZipEntry
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
@Override
void addZipEntry(ZipEntry entry) {
String name = entry.getName();
if (!name.startsWith(prefix.path)) {
return;
}
name = name.substring(prefix.path.length());
int i = name.lastIndexOf('/');
RelativeDirectory dirname = new RelativeDirectory(name.substring(0, i+1));
String basename = name.substring(i + 1);
if (basename.length() == 0) {
return;
}
List<String> list = map.get(dirname);
if (list == null)
list = List.nil();
list = list.prepend(basename);
map.put(dirname, list);
}
示例7: list
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
public Iterable<JavaFileObject> list(Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
boolean recurse)
throws IOException
{
// validatePackageName(packageName);
nullCheck(packageName);
nullCheck(kinds);
Iterable<? extends File> path = getLocation(location);
if (path == null)
return List.nil();
RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
for (File directory : path)
listContainer(directory, subdirectory, kinds, recurse, results);
return results.toList();
}
示例8: getFileForOutput
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的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);
}
示例9: list
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER)
public Iterable<JavaFileObject> list(Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
boolean recurse)
throws IOException
{
checkNotModuleOrientedLocation(location);
// validatePackageName(packageName);
nullCheck(packageName);
nullCheck(kinds);
Iterable<? extends Path> path = getLocationAsPaths(location);
if (path == null)
return List.nil();
RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
ListBuffer<JavaFileObject> results = new ListBuffer<>();
for (Path directory : path) {
Container container = getContainer(directory);
container.list(directory, subdirectory, kinds, recurse, results);
}
return results.toList();
}
示例10: getFileForInput
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的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);
}
示例11: getFileForOutput
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的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);
}
示例12: list
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER)
public Iterable<JavaFileObject> list(Location location,
String packageName,
Set<JavaFileObject.Kind> kinds,
boolean recurse)
throws IOException
{
// validatePackageName(packageName);
nullCheck(packageName);
nullCheck(kinds);
Iterable<? extends Path> path = getLocationAsPaths(location);
if (path == null)
return List.nil();
RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
ListBuffer<JavaFileObject> results = new ListBuffer<>();
for (Path directory : path) {
Container container = getContainer(directory);
container.list(directory, subdirectory, kinds, recurse, results);
}
return results.toList();
}
示例13: getFileForInput
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的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);
}
示例14: getFileForOutput
import com.sun.tools.javac.file.RelativePath.RelativeDirectory; //导入依赖的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);
}