On Sun, Nov 22, 2009 at 01:00:51PM -0500, John Harrop wrote: >On Sun, Nov 22, 2009 at 12:55 PM, David Brown <cloj...@davidb.org> wrote: > >> java.nio.channels.FileChannel contains some .write methods: >> >> [27] write : int (ByteBuffer) >> [28] write : int (ByteBuffer,long) >> [29] write : long (ByteBuffer[]) >> [30] write : long (ByteBuffer[],int,int) >> >> I have an array of ByteBufers, but I can't figure out how to call #29 >> without it being a reflecting call. Giving a type of #^objects >> doesn't seem to help. >> >> (defn foo [#^FileChannel chan, bufs] >> (.write chan (to-array bufs))) >> >> gives a reflection warning. >> >> Any ideas?
>Try #^[LByteBuffer; That doesn't parse. I did get it to work with reflection, by using (into-array ByteBuffer bufs) instead of to-array. That way I at least get the right array type, even if the compiler can't figure it out. Any idea what kind of performance hit this actually ends up being? David -- 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