This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Difference between the getResource and getResource as a Stream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between the getResource and getResource as a Stream" Watch "Difference between the getResource and getResource as a Stream" New topic
Author

Difference between the getResource and getResource as a Stream

kiranb reddy
Greenhorn

Joined: Sep 28, 2008
Posts: 20
Hi,

Could anyone please, explain the difference between the getResource and getResource as a stream.

Please explain me with an example.


Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Was the Javadoc not clear? What aspects need clarification?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

One returns a URL, one returns an InputStream. That's pretty clear to me.

In fact, getResourceAsStream is actually shorthand for the following:

Copied directly from the Java 6 source code of ClassLoader.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between the getResource and getResource as a Stream
 
Similar Threads
== and .equals()
Data Stream and Byte Stream
getResource & getRealPath
difference between error and runtime exception
What is the diff. between character-stream and byte stream which one is better?why?