Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
866 B
24 lines
866 B
package dev.openrs2.asm.io
|
|
|
|
import dev.openrs2.asm.classpath.ClassPath
|
|
import dev.openrs2.asm.classpath.Library
|
|
import dev.openrs2.compress.gzip.Gzip
|
|
import java.io.ByteArrayInputStream
|
|
import java.io.ByteArrayOutputStream
|
|
import java.io.OutputStream
|
|
import java.util.jar.JarInputStream
|
|
import java.util.jar.Pack200
|
|
|
|
class Pack200LibraryWriter : LibraryWriter {
|
|
override fun write(output: OutputStream, classPath: ClassPath, library: Library) {
|
|
ByteArrayOutputStream().use { tempOutput ->
|
|
JarLibraryWriter().write(tempOutput, classPath, library)
|
|
|
|
return JarInputStream(ByteArrayInputStream(tempOutput.toByteArray())).use { jarInput ->
|
|
Gzip.createHeaderlessOutputStream(output).use { gzipOutput ->
|
|
Pack200.newPacker().pack(jarInput, gzipOutput)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|