Interface PackContents
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
boolean
exists(PackType type, ResourcePath path)
Tests if this pack contains an entry at the givenResourcePath
.java.util.Set<java.lang.String>
namespaces(PackType type)
Gets thenamespaces
pertype
.java.util.Collection<ResourcePath>
paths(PackType type, java.lang.String namespace, java.lang.String prefix, int depth, java.util.function.Predicate<java.lang.String> filter)
Finds all theResourcePath
s in this pack matching the prefix and filter, and within the given depth.Resource
requireResource(PackType type, ResourcePath path)
java.util.Optional<Resource>
resource(PackType type, ResourcePath path)
-
-
-
Method Detail
-
resource
java.util.Optional<Resource> resource(PackType type, ResourcePath path) throws java.io.IOException
Gets aresource
within apath
pertype
.If a resource is returned, be aware that is requires closing when you have finished working with the resource.
- Parameters:
type
- The typepath
- The domain named path- Returns:
- The resource
- Throws:
java.io.IOException
-
requireResource
Resource requireResource(PackType type, ResourcePath path) throws java.io.IOException
Gets aresource
within apath
pertype
.Ensure that you close the resource once you have finished working with it!
- Parameters:
type
- The typepath
- The domain named path- Returns:
- The resource
- Throws:
java.io.IOException
-
paths
java.util.Collection<ResourcePath> paths(PackType type, java.lang.String namespace, java.lang.String prefix, int depth, java.util.function.Predicate<java.lang.String> filter)
Finds all theResourcePath
s in this pack matching the prefix and filter, and within the given depth.- Parameters:
type
- The typenamespace
- The namespace to searchprefix
- The prefix of the pathdepth
- The depth to searchfilter
- The filter every path must match- Returns:
- A collection of matching paths
- See Also:
PackType
-
exists
boolean exists(PackType type, ResourcePath path)
Tests if this pack contains an entry at the givenResourcePath
.- Parameters:
type
- The typepath
- The resource path- Returns:
- True if it exists, false if it does not
- See Also:
PackType
-
namespaces
java.util.Set<java.lang.String> namespaces(PackType type)
Gets thenamespaces
pertype
.- Parameters:
type
- The type- Returns:
- The set of namespaces
-
close
void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-