Skip to content

Commit

Permalink
update commons-compress
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Nov 26, 2024
1 parent cfede99 commit 1e66f6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ dependencies {
implementation("commons-io:commons-io:2.16.1")

// pack200 provided by apache commons-compress
implementation("org.apache.commons:commons-compress:1.26.1")
implementation("org.apache.commons:commons-compress:1.27.1")

// aw
implementation("net.fabricmc:access-widener:2.1.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,13 @@ class FG2TaskApplyBinPatches(private val project: Project) {
fun setup(patches: File, side: String) {
val matcher = Pattern.compile(String.format("binpatch/%s/.*.binpatch", side))
val jis: JarInputStream
try {
val binpatchesDecompressed = LzmaInputStream(FileInputStream(patches), Decoder())
val inBytes = ByteArrayInputStream(binpatchesDecompressed.readBytes())
val jarBytes = ByteArrayOutputStream()
val jos = JarOutputStream(jarBytes)
val binpatchesDecompressed = LzmaInputStream(FileInputStream(patches), Decoder())
val inBytes = ByteArrayInputStream(binpatchesDecompressed.readBytes())
val jarBytes = ByteArrayOutputStream()
JarOutputStream(jarBytes).use { jos ->
Pack200UnpackerAdapter().unpack(inBytes, jos)
jis = JarInputStream(ByteArrayInputStream(jarBytes.toByteArray()))
} catch (e: Exception) {
throw RuntimeException(e)
}
jis = JarInputStream(ByteArrayInputStream(jarBytes.toByteArray()))
log("Reading Patches:")
do {
try {
Expand All @@ -133,7 +130,7 @@ class FG2TaskApplyBinPatches(private val project: Project) {
@Throws(IOException::class)
private fun readPatch(patchEntry: JarEntry, jis: JarInputStream): ClassPatch {
log("\t%s", patchEntry.name)
val input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis))
val input = ByteStreams.newDataInput(jis.readBytes())
val name = input.readUTF()
val sourceClassName = input.readUTF()
val targetClassName = input.readUTF()
Expand Down

0 comments on commit 1e66f6f

Please sign in to comment.