File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting stream for resource

 
saravanan ragunathan
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
T. Huy Nguyen
Ranch Hand
Posts: 57
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic