On Thu, Feb 27, 2014 at 3:44 PM, larry google groups <
[email protected]> wrote:
> I tried this too:
>
> (ns tma-make-thumbnails.make-images
> (:import
> (java.util UUID)
> (javax.imageio ImageIO)
> (java.awt.image BufferedImage)
> (javax.imageio ImageReader))
>
>
>
> (defn get-file-as-image [filename]
> {:pre [(= (type filename) java.lang.String)
> (fs/exists? filename)
> (fs/file? (io/as-file filename))]
> :post [(do (pp/pprint %) true)
> (= (type %) java.awt.image.BufferedImage)]}
> (.read ImageIO (io/as-file filename)))
>
This is trying to invoke the "read" method of the Class instance
representing "javax.imageio.ImageIO". This is surely not what you want.
> but that only gives me:
>
> Exception in thread "Thread-1" java.lang.IllegalArgumentException: No
> matching method found: read for class java.lang.Class
>
> I don't get why ImageIO is java.lang.Class after I imported it.
>
>
>
>
>
> On Thursday, February 27, 2014 3:09:53 PM UTC-5, larry google groups wrote:
>>
>> I have no background with Java so I tend to suffer pain when dealing with
>> it. I am trying to create a thumbnail for an image, but my code dies on the
>> :post assertion of this function:
>>
>> (defn get-file-as-image [filename]
>> {:pre [(= (type filename) java.lang.String)
>> (fs/exists? filename)
>> (fs/file? (io/as-file filename))]
>> :post [(do (pp/pprint %) true)
>> (= (type %) BufferedImage)]}
>> (javax.imageio.ImageIO/read (io/as-file filename)))
>>
>
This is the correct syntax for invoking a static method of a class. I'm not
sure why it's not working for you. What kind of file are you trying to load?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.