A problem with using enumeration-seq with java.util.jar.JarFile.

2011-10-19 Thread mmwaikar
Hi,

I want to read the contents of one of the files in a jar file. Here's the 
documentation -
http://download.oracle.com/javase/6/docs/api/java/util/jar/JarFile.html

Now, the doc. of entries method specifies it returns an 
EnumerationJarEntry, whereas -

(map #(class %) (enumeration-seq (.entries some-jar-file)))

shows all are - java.util.jar.JarFile$JarFileEntry 

For this reason, the getInputStream method which expects a ZipEntry (a 
JarEntry could be passed to ZipEntry as the former derives from the latter) 
doesn't work on 
the above type.

Is this an issue with enumeration-seq, or the way I am using it or is the 
doc. for JarFile is not correct or something else?

Please let me know.

Thanks,
Manoj.


-- 
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

Re: A problem with using enumeration-seq with java.util.jar.JarFile.

2011-10-19 Thread Alan Malloy
JarEntries are ZipEntries - there is no problem here.

user= (supers java.util.jar.JarFile$JarFileEntry)
#{java.util.zip.ZipEntry java.util.zip.ZipConstants java.lang.Object
java.util.jar.JarEntry java.lang.Cloneable}
user= (isa? java.util.jar.JarFile$JarFileEntry
java.util.jar.JarEntry)
true

On Oct 19, 2:52 am, mmwaikar mmwai...@gmail.com wrote:
 Hi,

 I want to read the contents of one of the files in a jar file. Here's the
 documentation 
 -http://download.oracle.com/javase/6/docs/api/java/util/jar/JarFile.html

 Now, the doc. of entries method specifies it returns an
 EnumerationJarEntry, whereas -

 (map #(class %) (enumeration-seq (.entries some-jar-file)))

 shows all are - java.util.jar.JarFile$JarFileEntry

 For this reason, the getInputStream method which expects a ZipEntry (a
 JarEntry could be passed to ZipEntry as the former derives from the latter)
 doesn't work on
 the above type.

 Is this an issue with enumeration-seq, or the way I am using it or is the
 doc. for JarFile is not correct or something else?

 Please let me know.

 Thanks,
 Manoj.

-- 
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


Re: A problem with using enumeration-seq with java.util.jar.JarFile.

2011-10-19 Thread mmwaikar
But then why does this fail -

(slurp (.getInputStream (first (enumeration-seq (.entries f)

with - No matching field found: getInputStream for class 
java.util.jar.JarFile$JarFileEntry.

-- 
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

Re: A problem with using enumeration-seq with java.util.jar.JarFile.

2011-10-19 Thread mmwaikar
Oops. Sorry, my bad. I am not using the JarFile object for the call.

-- 
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

Re: A problem with using enumeration-seq with java.util.jar.JarFile.

2011-10-19 Thread Ben Smith-Mannschott
I've been hacking around with jars in clojure recently. You might find
some ideas here: https://gist.github.com/1300472

// Ben

On Wed, Oct 19, 2011 at 14:34, mmwaikar mmwai...@gmail.com wrote:
 But then why does this fail -

 (slurp (.getInputStream (first (enumeration-seq (.entries f)

 with - No matching field found: getInputStream for class
 java.util.jar.JarFile$JarFileEntry.

 --
 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 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