@ -64,6 +64,7 @@ import org.springframework.boot.loader.tools.ReachabilityMetadataProperties;
@@ -64,6 +64,7 @@ import org.springframework.boot.loader.tools.ReachabilityMetadataProperties;
import org.springframework.util.Assert ;
import org.springframework.util.StreamUtils ;
import org.springframework.util.StringUtils ;
import org.springframework.util.function.ThrowingSupplier ;
/ * *
* A { @link CopyAction } for creating a Spring Boot zip archive ( typically a jar or war ) .
@ -325,7 +326,7 @@ class BootZipCopyAction implements CopyAction {
@@ -325,7 +326,7 @@ class BootZipCopyAction implements CopyAction {
private void writeJarModeLibrary ( String location , JarModeLibrary library ) throws IOException {
String name = location + library . getName ( ) ;
writeEntry ( name , ZipEntryContentWriter . fromInputStream ( library . openStream ( ) ) , false ,
( entry ) - > prepareStoredEntry ( library . openStream ( ) , false , entry ) ) ;
( entry ) - > prepareStoredEntry ( library : : openStream , false , entry ) ) ;
if ( BootZipCopyAction . this . layerResolver ! = null ) {
Layer layer = BootZipCopyAction . this . layerResolver . getLayer ( library ) ;
Assert . state ( this . layerIndex ! = null , "'layerIndex' must not be null" ) ;
@ -429,12 +430,12 @@ class BootZipCopyAction implements CopyAction {
@@ -429,12 +430,12 @@ class BootZipCopyAction implements CopyAction {
}
private void prepareStoredEntry ( FileCopyDetails details , ZipArchiveEntry archiveEntry ) throws IOException {
prepareStoredEntry ( details . open ( ) , BootZipCopyAction . this . requiresUnpack . isSatisfiedBy ( details ) ,
prepareStoredEntry ( details : : open , BootZipCopyAction . this . requiresUnpack . isSatisfiedBy ( details ) ,
archiveEntry ) ;
}
private void prepareStoredEntry ( InputStream input , boolean unpack , ZipArchiveEntry archiveEntry )
throws IOException {
private void prepareStoredEntry ( ThrowingSupplier < InputStream > input , boolean unpack ,
ZipArchiveEntry archiveEntry ) throws IOException {
new StoredEntryPreparator ( input , unpack ) . prepareStoredEntry ( archiveEntry ) ;
}
@ -564,10 +565,10 @@ class BootZipCopyAction implements CopyAction {
@@ -564,10 +565,10 @@ class BootZipCopyAction implements CopyAction {
private long size ;
StoredEntryPreparator ( InputStream inputStream , boolean unpack ) throws IOException {
StoredEntryPreparator ( ThrowingSupplier < InputStream > input , boolean unpack ) throws IOException {
this . unpack = unpack ;
try ( inputStream ) {
load ( inputS tream) ;
try ( InputStream stream = input . get ( ) ) {
load ( s tream) ;
}
}