Class AbstractPathResolver

java.lang.Object
net.covers1624.coffeegrinder.util.resolver.AbstractPathResolver
All Implemented Interfaces:
Closeable, AutoCloseable, Resolver
Direct Known Subclasses:
FolderResolver, JarResolver

public abstract class AbstractPathResolver extends Object implements Resolver
Created by covers1624 on 8/4/21.
  • Field Details

    • path

      protected final Path path
    • files

      @Nullable protected @Nullable Set<String> files
  • Constructor Details

    • AbstractPathResolver

      protected AbstractPathResolver(Path path)
  • Method Details

    • validate

      protected abstract void validate()
    • getRootPath

      protected Path getRootPath()
    • getFiles

      protected final Set<String> getFiles()
    • getResource

      public byte @Nullable [] getResource(String name) throws IOException
      Description copied from interface: Resolver
      Gets the bytes for a given resource.
      Specified by:
      getResource in interface Resolver
      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

      public boolean hasResource(String name)
      Description copied from interface: Resolver
      Checks if this resolver is capable of resolving the given resource.
      Specified by:
      hasResource in interface Resolver
      Parameters:
      name - The resource name.
      Returns:
      If the resolver can resolve this class.
    • getAllClasses

      public net.covers1624.quack.collection.FastStream<String> getAllClasses()
      Description copied from interface: Resolver
      Gets all the classes available from this Resolver.
      Specified by:
      getAllClasses in interface Resolver
      Returns:
      The classes.
    • getAllResources

      public net.covers1624.quack.collection.FastStream<String> getAllResources()
      Description copied from interface: Resolver
      Gets all the non-class files available from this Resolver.
      Specified by:
      getAllResources in interface Resolver
      Returns:
      The non-class files.