22 package com.realtime.crossfire.jxclient.skin.source;
25 import java.io.IOException;
26 import java.io.InputStream;
27 import org.jetbrains.annotations.NotNull;
56 public InputStream
getInputStream(@NotNull
final String name)
throws IOException {
57 final InputStream inputStream =
getClassLoader().getResourceAsStream(baseName+
"/"+name);
58 if (inputStream == null) {
59 throw new IOException(
"resource '"+baseName+
"/"+name+
"' not found");
69 public String
getURI(@NotNull
final String name) {
70 return "resource:"+baseName+
"/"+name;
79 final ClassLoader classLoader = getClass().getClassLoader();
80 if (classLoader != null) {
84 final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
85 if (systemClassLoader != null) {
86 return systemClassLoader;
89 throw new InternalError(
"cannot find class loader");
InputStream getInputStream(@NotNull final String name)
Returns an InputStream for a resource name.the resource name the input stream for the resource if the...
Abstract base class for JXCSkinSource implementations.
JXCSkinClassSource(@NotNull final String baseName)
Creates a new instance.
String getURI(@NotNull final String name)
Returns a description of the location of a resource name.the resource name the description of the res...
ClassLoader getClassLoader()
Returns the ClassLoader to use.
final String baseName
The base resource name to prepend to all resource names.
void checkAccess()
Checks that the skin exists and can be accessed.
Exception thrown if a skin related problem occurs.
A JXCSkinSource that loads via the class loader.