public class DefaultResourcePack extends Object implements ResourcePack
| Modifier and Type | Field and Description |
|---|---|
private static Logger |
LOGGER |
Set<String> |
namespaces |
static Class<?> |
resourceClass |
static Path |
resourcePath |
private static Map<ResourceType,FileSystem> |
typeToFileSystem |
| Constructor and Description |
|---|
DefaultResourcePack(String[] namespaces) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
contains(ResourceType type,
Identifier id) |
protected InputStream |
findInputStream(ResourceType type,
Identifier id) |
Collection<Identifier> |
findResources(ResourceType type,
String namespace,
String prefix,
int maxDepth,
Predicate<String> pathFilter) |
private static void |
getIdentifiers(Collection<Identifier> collection,
int maxDepth,
String namespace,
Path path,
String searchLocation,
Predicate<String> predicate) |
protected InputStream |
getInputStream(String path) |
String |
getName() |
Set<String> |
getNamespaces(ResourceType type) |
private static String |
getPath(ResourceType type,
Identifier id) |
private static boolean |
isValidUrl(String fileName,
URL url) |
InputStream |
open(ResourceType type,
Identifier id) |
InputStream |
openRoot(String fileName) |
<T> T |
parseMetadata(ResourceMetadataReader<T> metaReader) |
public static Path resourcePath
private static final Logger LOGGER
public static Class<?> resourceClass
private static final Map<ResourceType,FileSystem> typeToFileSystem
public DefaultResourcePack(String[] namespaces)
public InputStream openRoot(String fileName) throws IOException
openRoot in interface ResourcePackIOExceptionpublic InputStream open(ResourceType type, Identifier id) throws IOException
open in interface ResourcePackIOExceptionpublic Collection<Identifier> findResources(ResourceType type, String namespace, String prefix, int maxDepth, Predicate<String> pathFilter)
findResources in interface ResourcePackprivate static void getIdentifiers(Collection<Identifier> collection, int maxDepth, String namespace, Path path, String searchLocation, Predicate<String> predicate)
@Nullable protected InputStream findInputStream(ResourceType type, Identifier id)
private static String getPath(ResourceType type, Identifier id)
private static boolean isValidUrl(String fileName, @Nullable URL url) throws IOException
IOException@Nullable protected InputStream getInputStream(String path)
public boolean contains(ResourceType type, Identifier id)
contains in interface ResourcePackpublic Set<String> getNamespaces(ResourceType type)
getNamespaces in interface ResourcePack@Nullable public <T> T parseMetadata(ResourceMetadataReader<T> metaReader)
parseMetadata in interface ResourcePackpublic String getName()
getName in interface ResourcePackpublic void close()
close in interface AutoCloseableclose in interface ResourcePack