atom feed5 messages in org.codehaus.groovy.user[groovy-user] copying a remote image
FromSent OnAttachments
Michael KimsalFeb 7, 2010 10:10 pm 
Jerome LacosteFeb 7, 2010 10:21 pm 
Jerome LacosteFeb 7, 2010 10:36 pm 
Bob BrownFeb 7, 2010 11:15 pm 
Michael KimsalFeb 8, 2010 5:45 am 
Subject:[groovy-user] copying a remote image
From:Michael Kimsal (mich@groovymag.com)
Date:Feb 7, 2010 10:10:16 pm
List:org.codehaus.groovy.user

Hello all:

I'm having trouble copying a remote image to a local server.

def url = "http://domain.com/images/foo.jpg".toURL() def outFile = new File("./a.jpg") outFile << url.text

This works when I run it locally (Groovy 1.6.3 - JVM 1.6.0_17 on OSX) but not
when I run it on a Grails system (Grails 1.2.0 JVM 1.6.0_17 on Centos 5.3).

The resulting file sizes are different, and while they both look like binary
files, one is renderable and one isn't.

There's probably a better way to do this, but I can not figure it out. Any
pointers on the 'groovy' way to do this? FWIW '.text' doesn't seem like the
right thing to be doing, because it's binary data I want, but it's working fine
in one system, just not the 'live' one I need.

Thanks.