On Fri, May 20, 2011 at 9:22 AM, Vincent Liard <vincent.li...@free.fr> wrote:
> (defn retailer-stock-update []
>  (wrap-multipart-params
>   (fn [req]
>     (let [xls (get (:params req) "stock-xls")]
>       (with-in-str [str (:bytes xls)]
>         (read-xls-stream str))))))
>
> As far as I have understood, (:bytes xls) is seen as a java byte
> array, since (class (:bytes xls)) displays "class [B"

That is correct. So try replacing the last two lines with:

(with-open [str (ByteArrayInputStream. (:bytes xls))]
  (read-xls-stream str))

The exception is because with-in-str is expecting a single string
argument, not a binding vector; with-in-str temporarily rebinds *in*
to read from a string rather than binding an arbitrary stream.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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

Reply via email to