mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 00:32:06 +00:00
init, thx MrExtremez
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
package org.apollo.jagcached.resource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* A resource provider composed of multiple resource providers.
|
||||
* @author Graham Edgecombe
|
||||
*/
|
||||
public final class CombinedResourceProvider extends ResourceProvider {
|
||||
|
||||
/**
|
||||
* An array of resource providers.
|
||||
*/
|
||||
private final ResourceProvider[] providers;
|
||||
|
||||
/**
|
||||
* Creates the combined resource providers.
|
||||
* @param providers The providers this provider delegates to.
|
||||
*/
|
||||
public CombinedResourceProvider(ResourceProvider... providers) {
|
||||
this.providers = providers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(String path) throws IOException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuffer get(String path) throws IOException {
|
||||
for (ResourceProvider provider : providers) {
|
||||
if (provider.accept(path)) {
|
||||
return provider.get(path);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user