/** * Load a named resource using the current threads context classloader. * * @param resourceName * The name of the resource to load * @throws IllegalArgumentException * resourceName can not be null * @throws IllegalArgumentException * resourceName must be found in given classloader */ public ClassLoaderAsset(String resourceName) { this(resourceName, SecurityActions.getThreadContextClassLoader()); }
/** * Load a named resource using the current threads context classloader. * * @param resourceName * The name of the resource to load * @throws IllegalArgumentException * resourceName can not be null * @throws IllegalArgumentException * resourceName must be found in given classloader */ public ClassLoaderAsset(String resourceName) { this(resourceName, SecurityActions.getThreadContextClassLoader()); }
/** * Read the byte size of a {@link Class}. * * @param clazz * The class * @return The byte size of the given {@link Class} * @throws Exception */ static int findLengthOfClass(Class<?> clazz) throws Exception { String classResourceName = getResourceNameForClass(clazz); InputStream in = SecurityActions.getThreadContextClassLoader().getResourceAsStream(classResourceName); return findLengthOfStream(in); }