Last active
August 29, 2015 14:14
-
-
Save johnzeringue/e2d6c89b698804a06058 to your computer and use it in GitHub Desktop.
Virtual Filesystems in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile 'com.google.jimfs:jimfs:1.0' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.jimfs.Configuration; | |
import com.google.common.jimfs.Jimfs; | |
// ... | |
// create filesystem and get a "virtual path" | |
FileSystem virtualFileSystem = Jimfs.newFileSystem(Configuration.unix()); | |
Path virtualPath = virtualFileSystem.getPath("virtual", "path"); | |
// use the path as you would any other | |
Files.exists(virtualPath); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment