@Test public void testAddFile() throws IOException, CancelledException { FileCache cache = new FileCache(cacheDir); File tmpFile = createTempFile("filecacheaddfile"); FileUtilities.writeStringToFile(tmpFile, "This is a test1"); FileCacheEntry fce = cache.addFile(tmpFile, monitor); Assert.assertTrue(fce.file.exists()); Assert.assertEquals("10428da10f5aa2793cb73c0b680e1621", fce.md5); Assert.assertEquals(1, cache.getFileAddCount()); }
public FileCacheEntry addFile(File f, TaskMonitor monitor) throws IOException, CancelledException { try (FileInputStream fis = new FileInputStream(f)) { return addStream(fis, monitor); } }
FileCache { public FileCacheEntry addFile(File f, TaskMonitor monitor) throws IOException, CancelledException { try (FileInputStream fis = new FileInputStream(f)) { return addStream(fis, monitor); } } }
FileCache { public FileCacheEntry addFile(File f, TaskMonitor monitor) throws IOException, CancelledException { try (FileInputStream fis = new FileInputStream(f)) { return addStream(fis, monitor); } } FileCache(File cacheDir); }
FileCache { public FileCacheEntry addFile(File f, TaskMonitor monitor) throws IOException, CancelledException { try (FileInputStream fis = new FileInputStream(f)) { return addStream(fis, monitor); } } FileCache(File cacheDir); synchronized void purge(); FileCacheEntry addFile(File f, TaskMonitor monitor); FileCacheEntry getFile(String md5); FileCacheEntry addStream(InputStream is, TaskMonitor monitor); FileCacheEntry pushStream(DerivedFilePushProducer pusher, TaskMonitor monitor); @Override String toString(); int getFileAddCount(); int getFileReUseCount(); long getStorageEstimateBytes(); long getMaxFileAgeMS(); }
FileCache { public FileCacheEntry addFile(File f, TaskMonitor monitor) throws IOException, CancelledException { try (FileInputStream fis = new FileInputStream(f)) { return addStream(fis, monitor); } } FileCache(File cacheDir); synchronized void purge(); FileCacheEntry addFile(File f, TaskMonitor monitor); FileCacheEntry getFile(String md5); FileCacheEntry addStream(InputStream is, TaskMonitor monitor); FileCacheEntry pushStream(DerivedFilePushProducer pusher, TaskMonitor monitor); @Override String toString(); int getFileAddCount(); int getFileReUseCount(); long getStorageEstimateBytes(); long getMaxFileAgeMS(); static final int MD5_HEXSTR_LEN; }