when i download the file i tried two methods to get the input stream for resource
first one is
second one is
in this code i had to specify full pathname...other than that..both works well
but which one is better ..for what?
"I Love Java Ranch"
T. Huy Nguyen
Joined: Nov 02, 2010
IMO, the 1st one is better. The 2nd one ties you to a specific type of file system, and requires an absolute path. If your server location change, that code may not work anymore. In addition, because it uses the normal Java IO, it can open any file in your server - to me, it's a security risk.