in spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/ExtractCommand.java [59:86]
protected void run(Map<Option, String> options, List<String> parameters) {
try {
File destination = options.containsKey(DESTINATION_OPTION) ? new File(options.get(DESTINATION_OPTION))
: this.context.getWorkingDir();
for (String layer : this.layers) {
if (parameters.isEmpty() || parameters.contains(layer)) {
mkDirs(new File(destination, layer));
}
}
try (ZipInputStream zip = new ZipInputStream(new FileInputStream(this.context.getJarFile()))) {
ZipEntry entry = zip.getNextEntry();
Assert.state(entry != null, "File '" + this.context.getJarFile().toString()
+ "' is not compatible with layertools; ensure jar file is valid and launch script is not enabled");
while (entry != null) {
if (!entry.isDirectory()) {
String layer = this.layers.getLayer(entry);
if (parameters.isEmpty() || parameters.contains(layer)) {
write(zip, entry, new File(destination, layer));
}
}
entry = zip.getNextEntry();
}
}
}
catch (IOException ex) {
throw new IllegalStateException(ex);
}
}