@@ -41,9 +41,9 @@ class ExtractImage(
4141 }
4242 }
4343 zipFile.getRawInputStream(payload)
44- extractFromOTAPackage(payload, channel, outFile )
44+ extractFromOTAPackage(payload, channel)
4545 } else {
46- extractFromFactoryImage(zipFile, channel, outFile )
46+ extractFromFactoryImage(zipFile, channel)
4747 }
4848 }
4949 }
@@ -52,27 +52,25 @@ class ExtractImage(
5252 private fun extractFromOTAPackage (
5353 payload : ZipArchiveEntry ,
5454 channel : DataSourceChannel ,
55- outFile : File ,
5655 ) {
5756 if (payload.method != ZipMethod .STORED .code) {
5857 throw IOException (" payload.bin is compressed, expected STORED method" )
5958 }
6059
6160 channel.slice(payload.dataOffset, payload.size).use { payloadChannel ->
62- Payload (payloadChannel).extract(outFile, { console.add(it) }, { logs.add(it) } )
61+ Payload (payloadChannel).extract(outFile, console, logs)
6362 }
6463 }
6564
6665 @Throws(IOException ::class )
6766 private fun extractFromFactoryImage (
6867 zipFile : ZipFile ,
6968 channel : DataSourceChannel ,
70- outFile : File
7169 ) {
7270 console.add(" - Processing as factory image package" )
7371
7472 findBootImageZipEntry(zipFile)?.let { entry ->
75- return extractImageFile(zipFile, entry, channel, outFile )
73+ return extractImageFile(zipFile, entry, channel)
7674 }
7775
7876 val imageZipEntry = zipFile.entries.asSequence().find { entry ->
@@ -81,7 +79,7 @@ class ExtractImage(
8179 }
8280 if (imageZipEntry != null ) {
8381 zipFile.getRawInputStream(imageZipEntry)
84- return extractFromInnerImageZip(imageZipEntry, channel, outFile )
82+ return extractFromInnerImageZip(imageZipEntry, channel)
8583 }
8684
8785 throw IOException (" inner image ZIP not found in factory image package" )
@@ -99,7 +97,6 @@ class ExtractImage(
9997 private fun extractFromInnerImageZip (
10098 entry : ZipArchiveEntry ,
10199 channel : DataSourceChannel ,
102- outFile : File
103100 ) {
104101 logs.add(" Found inner image ZIP: ${entry.name} " )
105102
@@ -114,7 +111,7 @@ class ExtractImage(
114111 .get().use { innerZipFile ->
115112 val targetEntry = findBootImageZipEntry(innerZipFile)
116113 ? : throw IOException (" boot image not found in inner image ZIP" )
117- return extractImageFile(innerZipFile, targetEntry, innerZipChannel, outFile )
114+ return extractImageFile(innerZipFile, targetEntry, innerZipChannel)
118115 }
119116 }
120117 }
@@ -124,7 +121,6 @@ class ExtractImage(
124121 zipFile : ZipFile ,
125122 entry : ZipArchiveEntry ,
126123 channel : DataSourceChannel ,
127- outFile : File ,
128124 ) {
129125 console.add(" - Found boot image entry: ${entry.name} (${entry.size} bytes)" )
130126 console.add(" - Downloading" )
0 commit comments