Class FileReader

java.lang.Object
com.renomad.minum.utils.FileReader
All Implemented Interfaces:
IFileReader

public final class FileReader extends Object implements IFileReader
Reads files from disk, optionally storing into a LRU cache.
  • Constructor Details

    • FileReader

      public FileReader(Map<String,byte[]> lruCache, boolean useCacheForStaticFiles, ILogger logger)
  • Method Details

    • readFile

      public byte[] readFile(String path) throws IOException
      Description copied from interface: IFileReader
      Reads a file from disk.

      Protects against some common negative cases:

      • If path is bad, log and return an empty byte array
      • If file does not exist, log and return an empty byte array
      Specified by:
      readFile in interface IFileReader
      Throws:
      IOException