Class SimplifiedResourceFileReader


  • public class SimplifiedResourceFileReader
    extends java.lang.Object
    Simple functions to read a byte array or a string out of a file in the resources.
    • Method Summary

      Modifier and Type Method Description
      java.lang.String[] getAllResourcesInFolder​(java.lang.String path)
      Get all files recursively in a folder from the resources.
      byte[] getByteArrayFromResources​(java.lang.String path)
      Get the content of a file from the resources.
      static SimplifiedResourceFileReader getInstance()
      Get the instance.
      java.lang.String getStringFromResources​(java.lang.String path)
      Get the content of a file from the resources.
      • Methods inherited from class java.lang.Object

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

      • getInstance

        public static SimplifiedResourceFileReader getInstance()
        Get the instance. This class is a singleton.
        Returns:
        The instance.
      • getByteArrayFromResources

        public byte[] getByteArrayFromResources​(java.lang.String path)
                                         throws java.io.IOException,
                                                java.lang.NullPointerException
        Get the content of a file from the resources.
        Parameters:
        path - The path to the file.
        Returns:
        The content of the file.
        Throws:
        java.io.IOException - If read process is not successful an IOException is triggered.
        java.lang.NullPointerException - If not found an NullPointerException is triggered.
      • getStringFromResources

        public java.lang.String getStringFromResources​(java.lang.String path)
        Get the content of a file from the resources.
        Parameters:
        path - The path to the file.
        Returns:
        The content of the file or NULL if the file cant be read.
      • getAllResourcesInFolder

        public java.lang.String[] getAllResourcesInFolder​(java.lang.String path)
        Get all files recursively in a folder from the resources.
        Parameters:
        path - The path to the folder.
        Returns:
        A list of all paths to the files.