title: Different ways of loading a file as an InputStream
body: <p>What's the difference between:</p>
  
  <pre><code>InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>InputStream is = this.getClass().getResourceAsStream(fileName)
  </code></pre>
  
  <p>When are each one more appropriate to use than the others?</p>
  
  <p>The file that I want to read is in the classpath as my class that reads the file.  My class and the file are in the same jar and packaged up in an EAR file, and deployed in WebSphere 6.1.</p>