Class ResourceManager


  • public class ResourceManager
    extends java.lang.Object
    A manager for resources.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceManager​(java.io.File location)
      Creates a resource manager.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes all resources.
      boolean exists​(java.lang.String name)
      Returns whether given resource file exists.
      java.io.File getLocation()
      Gets the resource location.
      java.io.Reader getReader​(java.lang.String name)
      Gets the reader.
      java.util.Set<java.lang.String> getResourceNames()
      Gets the resource names.
      java.io.PrintWriter getWriter​(java.lang.String name)
      Gets the writer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResourceManager

        public ResourceManager​(java.io.File location)
        Creates a resource manager.
        Parameters:
        location - the resource location
    • Method Detail

      • getResourceNames

        public java.util.Set<java.lang.String> getResourceNames()
        Gets the resource names.
        Returns:
        the names, never null
      • getLocation

        public java.io.File getLocation()
        Gets the resource location.
        Returns:
        the location
      • getWriter

        public java.io.PrintWriter getWriter​(java.lang.String name)
                                      throws java.io.IOException
        Gets the writer.
        Parameters:
        name - the writer's name
        Returns:
        the writer
        Throws:
        java.io.IOException - if writer could not be created
      • getReader

        public java.io.Reader getReader​(java.lang.String name)
                                 throws java.io.IOException
        Gets the reader.
        Parameters:
        name - the reader's name
        Returns:
        the reader
        Throws:
        java.io.IOException - if reader could not be created
      • exists

        public boolean exists​(java.lang.String name)
        Returns whether given resource file exists.
        Parameters:
        name - the file;s name
        Returns:
        true if exists
      • close

        public void close()
                   throws java.io.IOException
        Closes all resources.
        Throws:
        java.io.IOException - if closing a resource failed