Skip to content

Instantly share code, notes, and snippets.

@osima
Created August 24, 2011 02:26
Show Gist options
  • Save osima/1167161 to your computer and use it in GitHub Desktop.
Save osima/1167161 to your computer and use it in GitHub Desktop.
binary file copy example in groovy
copy = { File src,File dest->
def input = src.newDataInputStream()
def output = dest.newDataOutputStream()
output << input
input.close()
output.close()
}
//File srcFile = new File(args[0])
//File destFile = new File(args[1])
File srcFile = new File('src.png')
File destFile = new File('dest.png')
copy(srcFile,destFile)
@akhikhl
Copy link

akhikhl commented Aug 1, 2013

xxDataxx is redundant. newInputStream, newOutputStream would suffice.

@piotrga
Copy link

piotrga commented Aug 6, 2013

good one! thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment