Class FileResourceFactory

java.lang.Object
io.sf.jclf.util.locale.ResourceFactory
io.sf.jclf.util.locale.FileResourceFactory

public class FileResourceFactory extends ResourceFactory
Factory of localized objects through filesystem.

Loads files from filesystem according to basename, extension and locale name.

  • Constructor Details

    • FileResourceFactory

      public FileResourceFactory(Associator assoc)
    • FileResourceFactory

      public FileResourceFactory()
  • Method Details

    • loadLocalFile

      public InputStream loadLocalFile(String baseFileName, String ext, String localeName) throws IOException
      Description copied from class: ResourceFactory
      Load a resource file.
      Specified by:
      loadLocalFile in class ResourceFactory
      Parameters:
      baseFileName - the basename of the path
      ext - the extension.
      localeName - the name of the locale, eg. es_ES.
      Returns:
      the input stream with the file contents.
      Throws:
      IOException - if the file cannot be loaded.
    • openInputStream

      protected InputStream openInputStream(String path)
      Opens an input stream to read the specified resource.
      Parameters:
      path - the path to the resource.
      Returns:
      the input stream, or null if the resource does not exist.