本文整理汇总了Java中jdk.internal.jimage.ImageReader类的典型用法代码示例。如果您正苦于以下问题:Java ImageReader类的具体用法?Java ImageReader怎么用?Java ImageReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageReader类属于jdk.internal.jimage包,在下文中一共展示了ImageReader类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
static SystemImage open() throws IOException {
if (modulesImageExists) {
// open a .jimage and build directory structure
final ImageReader image = ImageReader.open(moduleImageFile);
image.getRootDirectory();
return new SystemImage() {
@Override
Node findNode(String path) throws IOException {
return image.findNode(path);
}
@Override
byte[] getResource(Node node) throws IOException {
return image.getResource(node);
}
@Override
void close() throws IOException {
image.close();
}
};
}
if (Files.notExists(explodedModulesDir))
throw new FileSystemNotFoundException(explodedModulesDir.toString());
return new ExplodedImage(explodedModulesDir);
}
示例2: findNode
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
private NodeAndImage findNode(byte[] path) throws IOException {
ImageReader image = bootImage;
Node node = bootImage.findNode(path);
if (node == null) {
image = extImage;
node = extImage.findNode(path);
}
if (node == null) {
image = appImage;
node = appImage.findNode(path);
}
if (node == null || node.isTopLevelPackageDir()) {
throw new NoSuchFileException(getString(path));
}
return new NodeAndImage(node, image);
}
示例3: ClassPathJimageEntry
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
public ClassPathJimageEntry(Path root) {
super(root);
if (!Files.exists(root)) {
throw new Error(root + " image file not found");
}
try {
reader = ImageReader.open(root);
} catch (IOException e) {
throw new Error("can not open " + root + " : " + e.getMessage(), e);
}
}
示例4: findImageLocation
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
/**
* Returns the ImageLocation for the given resource, {@code null}
* if not found.
*/
private ImageLocation findImageLocation(String name) throws IOException {
Objects.requireNonNull(name);
if (closed)
throw new IOException("ModuleReader is closed");
ImageReader imageReader = SystemImage.reader();
if (imageReader != null) {
return imageReader.findLocation(module, name);
} else {
// not an images build
return null;
}
}
示例5: ModuleContentSpliterator
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
ModuleContentSpliterator(String module) throws IOException {
moduleRoot = "/modules/" + module;
stack = new ArrayDeque<>();
// push the root node to the stack to get started
ImageReader.Node dir = SystemImage.reader().findNode(moduleRoot);
if (dir == null || !dir.isDirectory())
throw new IOException(moduleRoot + " not a directory");
stack.push(dir);
iterator = Collections.emptyIterator();
}
示例6: reader
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
static ImageReader reader() {
return READER;
}
示例7: release
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
@Override
public void release(ByteBuffer bb) {
Objects.requireNonNull(bb);
ImageReader.releaseByteBuffer(bb);
}
示例8: openImage
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
private static ImageReader openImage(Path path) throws IOException {
ImageReader image = ImageReader.open(path.toString());
image.getRootDirectory();
return image;
}
示例9: NodeAndImage
import jdk.internal.jimage.ImageReader; //导入依赖的package包/类
NodeAndImage(Node node, ImageReader image) {
this.node = node; this.image = image;
}