Class Resource


  • public final class Resource
    extends Object
    This utility is used to read any resource such as dtd file or xml file from a jar file or from a file system we use java class delegation to the class loader to achieve this
    • Constructor Detail

      • Resource

        public Resource()
    • Method Detail

      • read

        public static String read​(String fileName,
                                  Class cl)
        Reads the resource from a class loader.
        Parameters:
        fileName - Resource to be read.
        cl - Class which delegates the classloader functionality.
        Returns:
        resource value.
      • read

        public static String read​(Reader aReader)
        Returns resource string from a reader.
        Parameters:
        aReader - Reader object.
        Returns:
        resource string from a reader.
      • read

        public static String read​(String fileName)
        Returns resource string from a file.
        Parameters:
        fileName - File name. Returns resource string from file.
      • save

        public static boolean save​(String aFileName,
                                   String aContent)
        Returns true if a string is successfully written to a file.
        Parameters:
        aFileName - File name.
        aContent - content to be written.
        Returns:
        true if a string is successfully written to a file.