private void dumpMethod(DexFile dex, String fqName, OutputStreamWriter out) {
    boolean wildcard = fqName.endsWith("*");
    int lastDot = fqName.lastIndexOf('.');

    if ((lastDot <= 0) || (lastDot == (fqName.length() - 1))) {
      context.err.println("bogus fully-qualified method name: " + fqName);
      return;
    }

    String className = fqName.substring(0, lastDot).replace('.', '/');
    String methodName = fqName.substring(lastDot + 1);
    ClassDefItem clazz = dex.getClassOrNull(className);

    if (clazz == null) {
      context.err.println("no such class: " + className);
      return;
    }

    if (wildcard) {
      methodName = methodName.substring(0, methodName.length() - 1);
    }

    ArrayList<EncodedMethod> allMeths = clazz.getMethods();
    TreeMap<CstNat, EncodedMethod> meths = new TreeMap<CstNat, EncodedMethod>();

    /*
     * Figure out which methods to include in the output, and get them
     * all sorted, so that the printout code is robust with respect to
     * changes in the underlying order.
     */
    for (EncodedMethod meth : allMeths) {
      String methName = meth.getName().getString();
      if ((wildcard && methName.startsWith(methodName))
          || (!wildcard && methName.equals(methodName))) {
        meths.put(meth.getRef().getNat(), meth);
      }
    }

    if (meths.size() == 0) {
      context.err.println("no such method: " + fqName);
      return;
    }

    PrintWriter pw = new PrintWriter(out);

    for (EncodedMethod meth : meths.values()) {
      // TODO: Better stuff goes here, perhaps.
      meth.debugPrint(pw, args.verboseDump);

      /*
       * The (default) source file is an attribute of the class, but
       * it's useful to see it in method dumps.
       */
      CstString sourceFile = clazz.getSourceFile();
      if (sourceFile != null) {
        pw.println("  source file: " + sourceFile.toQuoted());
      }

      Annotations methodAnnotations = clazz.getMethodAnnotations(meth.getRef());
      AnnotationsList parameterAnnotations = clazz.getParameterAnnotations(meth.getRef());

      if (methodAnnotations != null) {
        pw.println("  method annotations:");
        for (Annotation a : methodAnnotations.getAnnotations()) {
          pw.println("    " + a);
        }
      }

      if (parameterAnnotations != null) {
        pw.println("  parameter annotations:");
        int sz = parameterAnnotations.size();
        for (int i = 0; i < sz; i++) {
          pw.println("    parameter " + i);
          Annotations annotations = parameterAnnotations.get(i);
          for (Annotation a : annotations.getAnnotations()) {
            pw.println("      " + a);
          }
        }
      }
    }

    pw.flush();
  }
Dumps any method with the given name in the given file.

@param dex {@code non-null;} the dex file
@param fqName {@code non-null;} the fully-qualified name of the method(s)
@param out {@code non-null;} where to dump to
android/android_framework/dex-maker/src/main/java/com/android/dx/command/dexer/Main.java