Mercurial > lasercutter
view src/clojure/contrib/jar.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 ;;; jar.clj: utilities for working with Java JAR files3 ;; by Stuart Sierra, http://stuartsierra.com/4 ;; April 19, 20096 ;; Copyright (c) Stuart Sierra, 2009. All rights reserved. The use7 ;; and distribution terms for this software are covered by the Eclipse8 ;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)9 ;; which can be found in the file epl-v10.html at the root of this10 ;; distribution. By using this software in any fashion, you are11 ;; agreeing to be bound by the terms of this license. You must not12 ;; remove this notice, or any other, from this software.15 (ns16 ^{:author "Stuart Sierra",17 :doc "Utilities for working with Java JAR files"}18 clojure.contrib.jar19 (:import (java.io File)20 (java.util.jar JarFile)))22 (defn jar-file?23 "Returns true if file is a normal file with a .jar or .JAR extension."24 [^File file]25 (and (.isFile file)26 (or (.endsWith (.getName file) ".jar")27 (.endsWith (.getName file) ".JAR"))))29 (defn filenames-in-jar30 "Returns a sequence of Strings naming the non-directory entries in31 the JAR file."32 [^JarFile jar-file]33 (map #(.getName %)34 (filter #(not (.isDirectory %))35 (enumeration-seq (.entries jar-file)))))