jarTransformer

Read and Transform the contents of jar file entry in the jar file.

Лицензия

Лицензия

Категории

Категории

ORM Данные
Группа

Группа

cn.nikeo.jar-transformer
Идентификатор

Идентификатор

jar-transformer
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

pom.sha512
Описание

Описание

jarTransformer
Read and Transform the contents of jar file entry in the jar file.
Ссылка на сайт

Ссылка на сайт

https://github.com/nikeorever/jarTransformer
Система контроля версий

Система контроля версий

https://github.com/nikeorever/jarTransformer

Скачать jar-transformer

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.10

Модули Проекта

Данный проект не имеет модулей.

jarTransformer

Maven Central

Read and Transform the contents of jar file entry in the jar file.

Sample

 transformJar(File("input.jar"), File("output.jar")) { inputJarEntry, outputJarEntryInputStream ->
      when {
          inputJarEntry.isClassFile() -> {
              // handle class file
              val clazz = ClassPool().makeClass(outputJarEntryInputStream)
              // modify bytecode
              if (clazz.name == "androidx.activity.R") {
                  clazz.addField(CtField(CtClass.intType, "generated_int_field", clazz), "100")
              }
              clazz.toBytecode()
          }
          inputJarEntry.isDirectory -> {
              outputJarEntryInputStream.readBytes()
          }
          else -> {
              outputJarEntryInputStream.readBytes()
          }
      }
 }

Or Use DSL API:

 transformJarDsl(File("input.jar"), File("output.jar")) {
      handleClassEntry { outputJarEntryInputStream ->
          // handle class file
          val clazz = ClassPool().makeClass(outputJarEntryInputStream)
          // modify bytecode
          if (clazz.name == "androidx.activity.R") {
              clazz.addField(CtField(CtClass.intType, "generated_int_field", clazz), "100")
          }
          clazz.toBytecode()
      }
 }

Download

Gradle Kotlin Script

repositories {
    mavenCentral()
}

dependencies {
    implementation("cn.nikeo.jar-transformer:jar-transformer:1.0.0")
}

Maven

<dependency>
  <groupId>cn.nikeo.jar-transformer</groupId>
  <artifactId>jar-transformer</artifactId>
  <version>1.0.0</version>
</dependency>

License

Apache License, Version 2.0, (LICENSE or https://www.apache.org/licenses/LICENSE-2.0)

Версии библиотеки

Версия
1.0.0