APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.tools.jlink.builder

public final Class DefaultImageBuilder

extends Object
implements ImageBuilder
Class Inheritance
All Implemented Interfaces
jdk.tools.jlink.builder.ImageBuilder
Imports
java.io.BufferedOutputStream, .BufferedWriter, .ByteArrayInputStream, .DataOutputStream, .FileInputStream, .IOException, .InputStream, .OutputStream, .UncheckedIOException, java.lang.module.ModuleDescriptor, java.nio.charset.StandardCharsets, java.nio.file.FileAlreadyExistsException, .Files, .Path, .Paths, .StandardOpenOption, java.nio.file.attribute.BasicFileAttributes, .PosixFilePermission, java.util.Collections, .HashMap, .HashSet, .List, .Map, .Objects, .Optional, .Properties, .Set, java.util.function.BiPredicate, .Consumer, java.util.stream.Stream, jdk.internal.util.OperatingSystem, jdk.tools.jlink.internal.BasicImageWriter, .ExecutableImage, .Platform, jdk.tools.jlink.plugin.PluginException, .ResourcePool, .ResourcePoolEntry, .ResourcePoolEntry.Type

Default Image Builder. This builder creates the default runtime image layout.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
DefaultImageBuilder.DefaultExecutableImage

The default java executable Image.

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
private final Map<String, String>
public static final String
public static final String
private final Path
private final Set<String>
private final Platform
private final Path

Constructor Summary

AccessConstructor and Description
public
DefaultImageBuilder(Path
The image root directory.
root
,
Map<String, String>
mapping of launcher command name to their module/main class
launchers
,
Platform
target platform of the image
targetPlatform
)

Default image builder constructor.

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
private String
entryToFileName(ResourcePoolEntry entry)

Returns the file name of this entry

private Path
entryToImagePath(ResourcePoolEntry entry)

Returns the path of the given entry to be written in the image

private static void
public ExecutableImage
getExecutableImage()

Implements jdk.tools.jlink.builder.ImageBuilder.getExecutableImage.

Gets the executable image that is generated.

public DataOutputStream
getJImageOutputStream()

Implements jdk.tools.jlink.builder.ImageBuilder.getJImageOutputStream.

The OutputStream to store the jimage file.

public Platform
getTargetPlatform()

Overrides default jdk.tools.jlink.builder.ImageBuilder.getTargetPlatform.

Gets the platform of the image.

private boolean
private String
nativeDir(String filename)

private static void
protected void
prepareApplicationFiles(ResourcePool
The image content.
imageContent
)

Generates launcher scripts.

private void
setExecutable(Path file)

chmod ugo+x file

private void
setReadOnly(Path file)

chmod ugo-w file

public void
storeFiles(ResourcePool files)

Overrides default jdk.tools.jlink.builder.ImageBuilder.storeFiles.

Store the external files.

private void
private void
writeSymLinkEntry(Path dstFile, Path target)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BIN_DIRNAMEback to summary
public static final String BIN_DIRNAME
CONF_DIRNAMEback to summary
public static final String CONF_DIRNAME
INCLUDE_DIRNAMEback to summary
public static final String INCLUDE_DIRNAME
launchersback to summary
private final Map<String, String> launchers
LIB_DIRNAMEback to summary
public static final String LIB_DIRNAME
MAN_DIRNAMEback to summary
public static final String MAN_DIRNAME
mdirback to summary
private final Path mdir
modulesback to summary
private final Set<String> modules
platformback to summary
private final Platform platform
rootback to summary
private final Path root

Constructor Detail

DefaultImageBuilderback to summary
public DefaultImageBuilder(Path root, Map<String, String> launchers, Platform targetPlatform) throws IOException

Default image builder constructor.

Parameters
root:Path

The image root directory.

launchers:Map<String, String>

mapping of launcher command name to their module/main class

targetPlatform:Platform

target platform of the image

Exceptions
NullPointerException:
If any of the params is null

Method Detail

acceptback to summary
private void accept(ResourcePoolEntry file) throws IOException
checkDuplicateResourcesback to summary
private void checkDuplicateResources(ResourcePool pool)
checkResourcePoolback to summary
private void checkResourcePool(ResourcePool pool)
entryToFileNameback to summary
private String entryToFileName(ResourcePoolEntry entry)

Returns the file name of this entry

entryToImagePathback to summary
private Path entryToImagePath(ResourcePoolEntry entry)

Returns the path of the given entry to be written in the image

forEachPathback to summary
private static void forEachPath(Path dir, BiPredicate<Path, BasicFileAttributes> matcher, Consumer<Path> consumer) throws IOException
getExecutableImageback to summary
public ExecutableImage getExecutableImage()

Implements jdk.tools.jlink.builder.ImageBuilder.getExecutableImage.

Doc from jdk.tools.jlink.builder.ImageBuilder.getExecutableImage.

Gets the executable image that is generated.

Annotations
@Override
getJImageOutputStreamback to summary
public DataOutputStream getJImageOutputStream()

Implements jdk.tools.jlink.builder.ImageBuilder.getJImageOutputStream.

Doc from jdk.tools.jlink.builder.ImageBuilder.getJImageOutputStream.

The OutputStream to store the jimage file.

Annotations
@Override
getTargetPlatformback to summary
public Platform getTargetPlatform()

Overrides default jdk.tools.jlink.builder.ImageBuilder.getTargetPlatform.

Doc from jdk.tools.jlink.builder.ImageBuilder.getTargetPlatform.

Gets the platform of the image.

Annotations
@Override
isWindowsback to summary
private boolean isWindows()
nativeDirback to summary
private String nativeDir(String filename)
patchScriptsback to summary
private static void patchScripts(ExecutableImage img, List<String> args) throws IOException
prepareApplicationFilesback to summary
protected void prepareApplicationFiles(ResourcePool imageContent) throws IOException

Generates launcher scripts.

Parameters
imageContent:ResourcePool

The image content.

setExecutableback to summary
private void setExecutable(Path file)

chmod ugo+x file

setReadOnlyback to summary
private void setReadOnly(Path file)

chmod ugo-w file

storeFilesback to summary
public void storeFiles(ResourcePool files)

Overrides default jdk.tools.jlink.builder.ImageBuilder.storeFiles.

Doc from jdk.tools.jlink.builder.ImageBuilder.storeFiles.

Store the external files.

Annotations
@Override
writeEntryback to summary
private void writeEntry(InputStream in, Path dstFile) throws IOException
writeSymLinkEntryback to summary
private void writeSymLinkEntry(Path dstFile, Path target) throws IOException
jdk.tools.jlink.builder back to summary

pack-priv final Class DefaultImageBuilder.DefaultExecutableImage

extends Object
implements ExecutableImage
Class Inheritance
  • java.lang.Object
  • jdk.tools.jlink.builder.DefaultImageBuilder.DefaultExecutableImage
All Implemented Interfaces
jdk.tools.jlink.internal.ExecutableImage

The default java executable Image.

Field Summary

Modifier and TypeField and Description
private final List<String>
private final Path
private final Set<String>
private final Platform

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static List<String>
public List<String>
getExecutionArgs()

Implements jdk.tools.jlink.internal.ExecutableImage.getExecutionArgs.

The list of arguments required to execute the image.

public Path
getHome()

Implements jdk.tools.jlink.internal.ExecutableImage.getHome.

Image home directory,

public Set<String>
getModules()

Implements jdk.tools.jlink.internal.ExecutableImage.getModules.

The names of the modules located in the image.

public Platform
public void
storeLaunchArgs(List<String> args)

Implements jdk.tools.jlink.internal.ExecutableImage.storeLaunchArgs.

Store new arguments required to execute the image.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argsback to summary
private final List<String> args
homeback to summary
private final Path home
modulesback to summary
private final Set<String> modules
platformback to summary
private final Platform platform

Constructor Detail

DefaultExecutableImageback to summary
pack-priv DefaultExecutableImage(Path home, Set<String> modules, Platform p)

Method Detail

createArgsback to summary
private static List<String> createArgs(Path home)
getExecutionArgsback to summary
public List<String> getExecutionArgs()

Implements jdk.tools.jlink.internal.ExecutableImage.getExecutionArgs.

Doc from jdk.tools.jlink.internal.ExecutableImage.getExecutionArgs.

The list of arguments required to execute the image.

Annotations
@Override
getHomeback to summary
public Path getHome()

Implements jdk.tools.jlink.internal.ExecutableImage.getHome.

Doc from jdk.tools.jlink.internal.ExecutableImage.getHome.

Image home directory,

Annotations
@Override
getModulesback to summary
public Set<String> getModules()

Implements jdk.tools.jlink.internal.ExecutableImage.getModules.

Doc from jdk.tools.jlink.internal.ExecutableImage.getModules.

The names of the modules located in the image.

Annotations
@Override
getTargetPlatformback to summary
public Platform getTargetPlatform()

Implements jdk.tools.jlink.internal.ExecutableImage.getTargetPlatform.

Doc from jdk.tools.jlink.internal.ExecutableImage.getTargetPlatform.

The Platform of the image.

Annotations
@Override
storeLaunchArgsback to summary
public void storeLaunchArgs(List<String> args)

Implements jdk.tools.jlink.internal.ExecutableImage.storeLaunchArgs.

Doc from jdk.tools.jlink.internal.ExecutableImage.storeLaunchArgs.

Store new arguments required to execute the image.

Annotations
@Override