Trying out IOUtils.copy.
This commit is contained in:
parent
94f3543292
commit
aeb7c74dd6
1 changed files with 3 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.example
|
package com.example
|
||||||
|
|
||||||
import org.apache.commons.compress.archivers.zip.*
|
import org.apache.commons.compress.archivers.zip.*
|
||||||
|
import org.apache.commons.compress.utils.IOUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -79,13 +80,11 @@ fun reZip3(jarIn: File, srcJar: File, zipOut: File) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val tmp = Files.createTempFile(MANIFEST, ".tmp").toFile()
|
val tmp = Files.createTempFile(MANIFEST, ".tmp").toFile()
|
||||||
tmp.writeText("Manifest-Version: 1.0\r\nMain-Class: com.beust.kobalt.MainKt\r\n")
|
tmp.writeText("Manifest-Version: 1.0\r\nCreated-By: ReZip3\r\nMain-Class: com.beust.kobalt.MainKt\r\n")
|
||||||
|
|
||||||
val entry = zos.createArchiveEntry(tmp, "META-INF/$MANIFEST")
|
val entry = zos.createArchiveEntry(tmp, "META-INF/$MANIFEST")
|
||||||
zos.putArchiveEntry(entry)
|
zos.putArchiveEntry(entry)
|
||||||
tmp.inputStream().use { ins ->
|
IOUtils.copy(tmp.inputStream(), zos)
|
||||||
ins.copyTo(zos, 50 * 1024)
|
|
||||||
}
|
|
||||||
zos.closeArchiveEntry()
|
zos.closeArchiveEntry()
|
||||||
|
|
||||||
src.close()
|
src.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue