Skip to content

Instantly share code, notes, and snippets.

@tksk
Created July 25, 2013 20:19
Show Gist options
  • Save tksk/6083356 to your computer and use it in GitHub Desktop.
Save tksk/6083356 to your computer and use it in GitHub Desktop.
jinsei
import AssemblyKeys._
assemblySettings
name := "jinsei"
version := "0.0.1"
scalaVersion := "2.10.2"
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % "1.7.5"
, "ch.qos.logback" % "logback-classic" % "1.0.13" % "runtime"
, "org.ow2.asm" % "asm-all" % "4.1"
)
import org.objectweb.asm._
import org.objectweb.asm.tree._
import java.io._
import java.lang.{Iterable => JIterable}
import java.util.jar._
import collection.JavaConverters._
/** Jinsei INSpects jar Entries' Inside
*/
object Jinsei extends App {
val jar= new JarFile(new File("csvjdbc.jar"))
for { ze <- jar.entries.asScala
if ze.getName.endsWith(".class")
if ze.getName.contains("DbfReader")
in = jar.getInputStream(ze)
} {
val cr = new ClassReader(in)
val classNode = new ClassNode
cr.accept(classNode, 0)
for(methodNode <- classNode.methods
.asInstanceOf[JIterable[MethodNode]].asScala){
println(methodNode.name+" "+methodNode.desc)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment