I need to create a URI to a virtual filesystem (jimfs) in java. I need to do this so that I can add files to a zip archive (by defining the zipfile as a filesystem). How can I point the URI variable below to my virtual filesystem? (or, if that won't work, is there another way to do this)
filesystem = Jimfs.newFileSystem(Configuration.unix())
URI zipDisk = zipFile.toUri()
FileSystems.newFileSystem(zipDisk, zip_properties).withCloseable { FileSystem zipfs ->
Path ZipFilePath = zipfs.getPath(fileToZip.getFileName().toString()) //Define the file as it will exist in the zipfile
Files.copy(fileToZip,ZipFilePath, StandardCopyOption.REPLACE_EXISTING);
}
This code produces a "may not have a path, query, or fragment" error.