spec.io
Class FileCache
java.lang.Object
spec.io.FileCache
public class FileCache
- extends java.lang.Object
This class cache (read only) files in memory, to be able to used
in benchmarks to avoid unwanted contention on the file system.
Note!
This class must be used in a thread safe way.
Files should therefore be put in cache by the harness execution.
This is done by loading validation files in cache before first
execution of the benchmark is started.
This is done by loading files in the setupBenchmark method in the
benchmarks.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileCache
public FileCache()
getStream
public java.io.ByteArrayInputStream getStream(java.lang.String fileName)
throws java.io.IOException
- Throws:
java.io.IOException
discard
public void discard(java.lang.String fileName)
getLength
public int getLength(java.lang.String fileName)
clearCache
public void clearCache()
getByteArray
public byte[] getByteArray(java.lang.String fileName)
loadFile
public void loadFile(java.lang.String fileName)
throws java.io.IOException
- Throws:
java.io.IOException