Files
Terrarum/lib/slick-source/org/newdawn/slick/util/ClasspathLocation.java
Song Minjae 059abff814 added sources for Slick
Former-commit-id: 1647fa32ef6894bd7db44f741f07c2f4dcdf9054
Former-commit-id: 0e5810dcfbe1fd59b13e7cabe9f1e93c5542da2d
2016-12-30 23:29:12 +09:00

29 lines
737 B
Java

package org.newdawn.slick.util;
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 ResourceLoader.class.getClassLoader().getResource(cpRef);
}
/**
* @see org.newdawn.slick.util.ResourceLocation#getResourceAsStream(java.lang.String)
*/
public InputStream getResourceAsStream(String ref) {
String cpRef = ref.replace('\\', '/');
return ResourceLoader.class.getClassLoader().getResourceAsStream(cpRef);
}
}