Interface ResourceProvider

All Known Implementing Classes:
AbstractResourceProvider, ResourceProviderImpl

public interface ResourceProvider
Instances of this interface are dedicated to reading resource files form the JVM's classpath and converting them into arrays of bytes.
Since:
5.0
Author:
Laurent Cohen
  • Method Details

    • getResource

      byte[] getResource(String resName, boolean lookupInFileSystem)
      Get a resource as an array of byte using a call to ClassLoader.getResource(). This method simply calls getResource(String, ClassLoader) with a null class loader.
      Parameters:
      resName - the name of the resource to find.
      lookupInFileSystem - whether resources should be looked up in the file system if not found in the classpath.
      Returns:
      the content of the resource as an array of bytes.
    • getResource

      byte[] getResource(String resName, ClassLoader classloader, boolean lookupInFileSystem)
      Get a resource as an array of byte using a call to ClassLoader.getResource().
      Parameters:
      resName - the name of the resource to find.
      classloader - the class loader to use to load the request resource.
      lookupInFileSystem - whether resources should be looked up in the file system if not found in the classpath.
      Returns:
      the content of the resource as an array of bytes.
    • getResource

      byte[] getResource(String resName, Collection<ClassLoader> classLoaders, boolean lookupInFileSystem)
      Get a resource as an array of byte using a call to ClassLoader.getResource().
      Parameters:
      resName - the name of the resource to find.
      classLoaders - the set of class loaders available to use to load the requested resource.
      lookupInFileSystem - whether resources should be looked up in the file system if not found in the classpath.
      Returns:
      the content of the resource as an array of bytes.
    • computeCallable

      byte[] computeCallable(byte[] serializedCallable)
      Compute a callable sent through the JPPF class loader.
      Parameters:
      serializedCallable - the callable to execute in serialized form.
      Returns:
      the serialized result of the callable's execution, or of an eventually resulting exception.
    • getMultipleResourcesAsBytes

      List<byte[]> getMultipleResourcesAsBytes(String name, ClassLoader classloader, boolean lookupInFileSystem)
      Get all resources associated with the specified resource name.
      Parameters:
      name - the name of the resources to look for.
      classloader - the class loader used to load the resources.
      lookupInFileSystem - whether resources should be looked up in the file system if not found in the classpath.
      Returns:
      the content of all found resources as a list of byte arrays.
    • getMultipleResourcesAsBytes

      List<byte[]> getMultipleResourcesAsBytes(String name, Collection<ClassLoader> classLoaders, boolean lookupInFileSystem)
      Get all resources associated with the specified resource name.
      Parameters:
      name - the name of the resources to look for.
      classLoaders - the set of class loaders available to load the resources.
      lookupInFileSystem - whether resources should be looked up in the file system if not found in the classpath.
      Returns:
      the content of all found resources as a list of byte arrays.
    • getMultipleResourcesAsBytes

      Map<String,List<byte[]>> getMultipleResourcesAsBytes(ClassLoader classloader, boolean lookupInFileSystem, String... names)
      Get all resources associated with each specified resource name.
      Parameters:
      classloader - the class loader used to load the resources.
      lookupInFileSystem - whether resources should be looked up in the file system if not found in the classpath.
      names - the names of all the resources to look for.
      Returns:
      A mapping of each resource names with a list of the byte content of corresponding resources in the classpath.
    • getMultipleResourcesAsBytes

      Map<String,List<byte[]>> getMultipleResourcesAsBytes(Collection<ClassLoader> classLoaders, boolean lookupInFileSystem, String... names)
      Get all resources associated with each specified resource name.
      Parameters:
      classLoaders - the set of class loader available to load the resources.
      lookupInFileSystem - whether resources should be looked up in the file system if not found in the classpath.
      names - the names of all the resources to look for.
      Returns:
      A mapping of each resource names with a list of the byte content of corresponding resources in the classpath.