Skip to content

Commit

Permalink
Renamed Jar2ASM to Io due to reader & writer class
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Mar 20, 2022
1 parent 5d146c3 commit ded2538
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/net/revanced/patcher/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import net.revanced.patcher.cache.Cache
import net.revanced.patcher.patch.Patch
import net.revanced.patcher.resolver.MethodResolver
import net.revanced.patcher.signature.Signature
import net.revanced.patcher.util.Jar2ASM
import net.revanced.patcher.util.Io
import java.io.InputStream
import java.io.OutputStream

Expand All @@ -23,7 +23,7 @@ class Patcher(
private val patches: MutableList<Patch> = mutableListOf()

init {
val classes = Jar2ASM.jar2asm(input);
val classes = Io.readClassesFromJar(input);
cache = Cache(classes, MethodResolver(classes, signatures).resolve())
}

Expand All @@ -48,6 +48,6 @@ class Patcher(
}

fun saveTo(output: OutputStream) {
Jar2ASM.asm2jar(input, output, cache.classes)
Io.writeClassesToJar(input, output, cache.classes)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import java.util.jar.JarEntry
import java.util.jar.JarInputStream
import java.util.jar.JarOutputStream

object Jar2ASM {
fun jar2asm(input: InputStream) = mutableListOf<ClassNode>().apply {
object Io {
fun readClassesFromJar(input: InputStream) = mutableListOf<ClassNode>().apply {
val jar = JarInputStream(input)
while (true) {
val e = jar.nextJarEntry ?: break
Expand All @@ -23,7 +23,7 @@ object Jar2ASM {
}
}

fun asm2jar(input: InputStream, output: OutputStream, classes: List<ClassNode>) {
fun writeClassesToJar(input: InputStream, output: OutputStream, classes: List<ClassNode>) {
val jis = JarInputStream(input)
val jos = JarOutputStream(output)

Expand Down

0 comments on commit ded2538

Please sign in to comment.