Interface Resolver
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AbstractPathResolver,FolderResolver,JarResolver,JModResolver
A Resolver, capable of loading the raw bytes for a given Class or Resource.
Created by covers1624 on 8/4/21.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()static ResolverfindResolver(Path path) Finds a resolver for the given file.net.covers1624.quack.collection.FastStream<String> Gets all the classes available from thisResolver.net.covers1624.quack.collection.FastStream<String> Gets all the non-class files available from thisResolver.default byte @Nullable []getClassBytes(String name) Gets the bytes for a given class.byte @Nullable []getResource(String name) Gets the bytes for a given resource.default booleanChecks if this resolver is capable of resolving the given class name.booleanhasResource(String name) Checks if this resolver is capable of resolving the given resource.
-
Method Details
-
getAllClasses
Gets all the classes available from thisResolver.- Returns:
- The classes.
- Throws:
IOException
-
getAllResources
Gets all the non-class files available from thisResolver.- Returns:
- The non-class files.
- Throws:
IOException
-
getClassBytes
Gets the bytes for a given class.- Parameters:
name- The class name.- Returns:
- The Class bytes, or literal null if no bytes were found.
- Throws:
IOException- If an error occurred whilst reading a file.- See Also:
-
hasClass
Checks if this resolver is capable of resolving the given class name.- Parameters:
name- The class name.- Returns:
- If the resolver can resolve this class.
-
getResource
Gets the bytes for a given resource.- Parameters:
name- The name of the input.- Returns:
- The bytes of the resource or literal null if no bytes were found.
- Throws:
IOException- If an error occurred whilst reading a file.- See Also:
-
hasResource
Checks if this resolver is capable of resolving the given resource.- Parameters:
name- The resource name.- Returns:
- If the resolver can resolve this class.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
findResolver
Finds a resolver for the given file.- Parameters:
path- The file path.- Returns:
- The
Resolver. - Throws:
IllegalArgumentException- Thrown if a resolver was not found for a given type.
-