Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #20085

Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream()

Received by 10.216.216.141 with SMTP id g13mr629562wep.3.1354595830023; Mon, 03 Dec 2012 20:37:10 -0800 (PST)
Received by 10.180.85.3 with SMTP id d3mr257051wiz.3.1354595829000; Mon, 03 Dec 2012 20:37:09 -0800 (PST)
Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!209.85.212.215.MISMATCH!m1no4786504wiv.0!news-out.google.com!ha8ni100851wib.1!nntp.google.com!m3no12180861wim.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Mon, 3 Dec 2012 20:37:08 -0800 (PST)
In-Reply-To <k9jcdu$jdc$1@dont-email.me>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
NNTP-Posting-Host 69.28.149.29
References <3c227741-7b7f-4cf8-b188-ce5268894031@googlegroups.com> <k9j0qj$ftg$1@dont-email.me> <890512f9-9df6-42dd-a151-993e09912ece@googlegroups.com> <k9jcdu$jdc$1@dont-email.me>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <de4ec0f0-3168-40c1-b010-ab64f43e9f88@googlegroups.com> (permalink)
Subject Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream()
From Lew <lewbloch@gmail.com>
Injection-Date Tue, 04 Dec 2012 04:37:10 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.programmer:20085

Show key headers only | View raw


markspace wrote:
> Lew wrote:
>> The names of the respective methods in this case are *not* named the
>> same!
> 
> 
> Huh, I totally misread that somehow.  I guess I need to pay closer 
> attention.

Well, the two classes do, in fact, sport a method of the same name, 'getResourceAsStream()'.

Your reply applies to those methods.

But the basis of the question is flawed - why should the same-named method in a different type
behave the same? Examples abound where they don't. Heck, two different 'Runnable' types don't
even do the same things in their 'run()' methods! And that's in the same type!

(To those who don't know me, the exclamation points are hints that I'm up to some 
rhetorical mischief.)

The fact that the original question didn't even match up same-named methods when there were 
such, and ones that do nearly the same thing at that, is bit interesting but doesn't materially 
alter the situation. Method names are not determinant of behavior in and of themselves, although 
in the case of interfaces like 'Runnable' they are indicative of a formal contract.

One really needs to turn to the API docs to resolve the original question. To make matters worse, 
there's another 'getResourceAsStream()' in the Java EE API 
<http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#getResourceAsStream(java.lang.String)>
and it doesn't use 'ClassLoader' at all!

What's to explain, OP? The Javadocs tell all you need to know.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream() zyng <xsli2@yahoo.com> - 2012-12-03 11:29 -0800
  Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream() markspace <-@.> - 2012-12-03 12:07 -0800
    Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream() Lew <lewbloch@gmail.com> - 2012-12-03 14:04 -0800
      Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream() markspace <-@.> - 2012-12-03 15:25 -0800
        Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream() Lew <lewbloch@gmail.com> - 2012-12-03 20:37 -0800
  Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream() zyng <xsli2@yahoo.com> - 2012-12-04 05:40 -0800
    Re: ClassLoader.getSystemResourceAsStream versus this.getClass().getResourceAsStream() Lew <lewbloch@gmail.com> - 2012-12-04 12:57 -0800

csiph-web