Skip to content

Instantly share code, notes, and snippets.

@hiredman
Created September 28, 2010 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiredman/601649 to your computer and use it in GitHub Desktop.
Save hiredman/601649 to your computer and use it in GitHub Desktop.
(defn list-classes [bytes]
(with-open [jar-is (JarInputStream. (java.io.ByteArrayInputStream. bytes))]
(doall (map
(fn [entry] (-> (.getName entry)
(.replaceAll "\\.class$" "")
(.replaceAll "/" ".")))
(filter
#(.endsWith (.getName %) ".class")
(take-while identity (repeatedly #(.getNextEntry jar-is))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment