/search-a-jar-for-methods

search a jar for classes containing a specified method name

Primary LanguageShellMIT LicenseMIT

search a jar for classes containing a specified method name

usage:
findClassMethod.sh jarClassPath [method-name]
jarClassPath - if alone, list all classes from the jar/class
method-name - list only classes containing the method-name

examples:
./findClassMethod.sh /usr/java/jdk1.8/jre/lib/ext/dnsns.jar lookupAllHostAddr
find path -type f -name '*.jar' -exec ./findClassMethod.sh {} methodXY ;
find path -type f -regex '.+.jar|.+.class' -exec ./findClassMethod.sh {} methodXY ;

sample output:

$ ./findClassMethod.sh test/test_jar.jar toString
--------------test/test_jar.jar-------------------
Compiled from "FailedError.java"
public class org.szb.FailedError extends java.lang.AssertionError {
  public org.szb.FailedError();
  public boolean isExpectedDefined();
  public boolean isActualDefined();
  public org.szb.ObjWrapper getExpected();
  public org.szb.ObjWrapper getActual();
  public java.lang.String toString();
}
Compiled from "ObjWrapper.java"
public final class org.szb.ObjWrapper implements java.io.Serializable {
  public static org.szb.ObjWrapper create(java.lang.Object);
  public java.io.Serializable getValue();
  public java.lang.String getStringRepresentation();
  public int getIdentityHashCode();
  public java.lang.String toString();
  static {};
}