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.
      Specified by:
      readFile in interface IFileReader
      Throws:
      IOException
    • getCacheLock

      public ReentrantLock getCacheLock()
      Returns the lock used to prevent concurrent modification exceptions when mutating the LRU cache data.
      This may be useful if you need to access the LRU cache, which, owing to how a least-recently-used cache works, will cause the data to mutate, and which requires to be protected with locks.