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 ResourcePack
IOException
public InputStream open(ResourceType type, Identifier id) throws IOException
open
in interface ResourcePack
IOException
public Collection<Identifier> findResources(ResourceType type, String namespace, String prefix, int maxDepth, Predicate<String> pathFilter)
findResources
in interface ResourcePack
private 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 ResourcePack
public Set<String> getNamespaces(ResourceType type)
getNamespaces
in interface ResourcePack
@Nullable public <T> T parseMetadata(ResourceMetadataReader<T> metaReader)
parseMetadata
in interface ResourcePack
public String getName()
getName
in interface ResourcePack
public void close()
close
in interface AutoCloseable
close
in interface ResourcePack