- All Known Implementing Classes:
FileReader
public interface IFileReader
An interface for the operations of reading a file.
This primarily exists to make testing easier.
-
Method Summary
Modifier and TypeMethodDescriptionThis returns theReentrantLockthat is used around theLRUCacheto allow access to the cache from other classes.Returns the LRU (least-recently-used) cache that is filled when usingreadFile(String)byte[]Reads a file from disk.
-
Method Details
-
readFile
Reads a file from disk.- Throws:
ForbiddenUseException- if the requested path includes bad file patterns, mainly ones to escape from the intended directories (like ".." or "/", etc)IllegalArgumentException- if the path is blankIOException
-
getCacheLock
ReentrantLock getCacheLock()This returns theReentrantLockthat is used around theLRUCacheto allow access to the cache from other classes. This is used in theWebFrameworkclass when accessing the cache for static files. -
getLruCache
Returns the LRU (least-recently-used) cache that is filled when usingreadFile(String)
-