ResourceLoader (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.util, interface: ResourceLoader

Package org.apache.lucene.util

# Interface ResourceLoader

All Known Implementing Classes:
  `ClasspathResourceLoader`, `ModuleResourceLoader`

public interface ResourceLoader
Abstraction for loading resources (streams, files, and classes).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> Class<? extends T>`
  `findClass(String cname, Class<T> expectedType)`
  Finds class of the name and expected type
  `default <T> T`
  `newInstance(String cname, Class<T> expectedType)`
  Creates an instance of the name and expected type
  `InputStream`
  `openResource(String resource)`
  Opens a named resource

- ## Method Details

  - ### openResource

    InputStream openResource(String resource) throws IOException
    Opens a named resource
    Throws:
      `IOException`

  - ### findClass

    <T> Class<? extends T> findClass(String cname, Class<T> expectedType)
    Finds class of the name and expected type

  - ### newInstance

    default <T> T newInstance(String cname, Class<T> expectedType)
    Creates an instance of the name and expected type