I like the StackOverflow answer for this:

http://stackoverflow.com/questions/5419125/using-java-api-from-clojure-reading-zip-file

(defn entries [zipfile]
  (enumeration-seq (.entries zipfile)))
(defn walkzip [fileName]
  (with-open [z (java.util.zip.ZipFile. fileName)]
             (doseq [e (entries z)]
                    (println (.getName e)))))



On Thu, Jun 13, 2013 at 1:25 PM, Leon Barrett <lbarr...@climate.com> wrote:

> Yeah, Clojure's while construct isn't really good at stuff like that. A
> loop is the basic thing I reach for, and I'd probably write it as:
>
> (loop []
>   (when-let [entry (.getNextEntry stream)]
>     (println entry)
>     (recur)))
>
>
> On Thursday, June 13, 2013 10:20:22 AM UTC-7, Josh Kamau wrote:
>>
>> Hi there ;
>>
>> How do i implement the following in clojure
>>
>>     while((entry = stream.getNextEntry())!=null)   {
>>
>>        System.out.println(entry.**getName());
>>
>>   }
>>
>> NOTE: calling getNextEntry moves the curse to the next entry.
>>
>> CONTEXT: I am trying to list the contents of a .zip file using 
>> http://docs.oracle.com/javase/**6/docs/api/java/util/zip/**ZipInputStream.html
>>  <http://docs.oracle.com/javase/6/docs/api/java/util/zip/ZipInputStream.html>
>>
>>
>> Regards.
>>
>> Josh
>>
>>
>>           --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to