Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Copy a file ?  RSS feed

 
Manish Jaju
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I am facing a problem, while copying a file from one location(which is outside deployment environment) to another location(inside deployment environment) at run time.
I can do same by reading each line of file, and writing it to destination file one by one.
Is there any direct method, where I can copy whole file from one location(which is outside deployment environment) to another location(inside deployment environment).
** I am using JBOSS as an application server. **
Any suggestion will be highly appreciated.
Thanks in advance.
Manish
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://jakarta.apache.org/commons/io/ provides a lot of useful functionality around IO - inclusive copying files.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NIO provides a way to do a direct copy. Have a look at the example at Java Almanac
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!