1

I'm using VFS2 to construct an in-memory filesystem (uring the ram scheme) for tests. After each test I've to clean up (destroy all created files and folders), I'm using the following command:

VFS.getManager().getFilesCache().close();

However this doesn't seem to clear everything! what's the proper way to do it?

bachr
  • 5,780
  • 12
  • 57
  • 92

1 Answers1

1

According to the Javadoc FileCache only closes the cache.

FileSystemManager manager = VFS.getManager();
FileObject root = manager.resolveFile("ram:/");
manager.closeFileSystem(root.getFileSystem());

The last line clears the filecache of the filesystem and will close the filesystem passed in

  • the `FilesCache.close()` javadoc says that it purges the whole cache! – bachr Dec 26 '14 at 14:27
  • 1
    This works for direct archives. For archives inside archives it is not clearing the cache. For eg. jar:zip:file:///test.zip/a.jar – deepika Sep 22 '15 at 11:36