<commit_before>package de.lessvoid.nifty.tools.resourceloader;

import java.io.InputStream;
import java.net.URL;

/**
 * A resource location that searches the classpath
 * 
 * @author kevin
 */
public class ClasspathLocation implements ResourceLocation {
  /**
   * @see org.newdawn.slick.util.ResourceLocation#getResource(java.lang.String)
   */
  public URL getResource(String ref) {
    String cpRef = ref.replace('\\', '/');
    return ClasspathLocation.class.getClassLoader().getResource(cpRef);
  }

  /**
   * @see org.newdawn.slick.util.ResourceLocation#getResourceAsStream(java.lang.String)
   */
  public InputStream getResourceAsStream(String ref) {
    String cpRef = ref.replace('\\', '/');
    return ClasspathLocation.class.getClassLoader().getResourceAsStream(cpRef);  
  }
}<commit_msg>Take current threads contextClassLoader for resource loading, which is more flexible<commit_after>package de.lessvoid.nifty.tools.resourceloader;

import java.io.InputStream;
import java.net.URL;

/**
 * A resource location that searches the classpath
 * 
 * @author kevin
 */
public class ClasspathLocation implements ResourceLocation {
  /**
   * @see org.newdawn.slick.util.ResourceLocation#getResource(java.lang.String)
   */
  public URL getResource(String ref) {
    String cpRef = ref.replace('\\', '/');
    return Thread.currentThread().getContextClassLoader().getResource(cpRef);
  }

  /**
   * @see org.newdawn.slick.util.ResourceLocation#getResourceAsStream(java.lang.String)
   */
  public InputStream getResourceAsStream(String ref) {
    String cpRef = ref.replace('\\', '/');
    return Thread.currentThread().getContextClassLoader().getResourceAsStream(cpRef);  
  }
}
{'fraction_non_alphanumeric': 0.12966252220248667, 'fraction_numerical': 0.0, 'mean_word_length': 4.365079365079365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4234432', 'n_tokens_mistral': 512, 'n_tokens_neox': 508, 'n_words': 94}