jimfs

java URI pointing to virtual filesystem

我怕爱的太早我们不能终老 提交于 2019-12-12 06:23:47
问题 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

JIMFS not recognized by ZipFileSystemProvider

▼魔方 西西 提交于 2019-12-01 09:14:04
I have a zip file created in jimfs (google in memory file system) from a byte array. When trying to open that file with ZipMemoryFileSystem , I get an error that the provider is not recognized. My code is as following: public static void test(byte[] document) { try { try (FileSystem memoryFileSystem = Jimfs.newFileSystem(Configuration.unix())) { Files.write(memoryFileSystem.getPath("/file.zip"), document); URI uri = URI.create("jar:" + memoryFileSystem.getPath("/file.zip").toUri()); Map<String, String> env = Collections.singletonMap("create", "false"); try (FileSystem zipfs = FileSystems

JIMFS not recognized by ZipFileSystemProvider

被刻印的时光 ゝ 提交于 2019-12-01 05:38:55
问题 I have a zip file created in jimfs (google in memory file system) from a byte array. When trying to open that file with ZipMemoryFileSystem , I get an error that the provider is not recognized. My code is as following: public static void test(byte[] document) { try { try (FileSystem memoryFileSystem = Jimfs.newFileSystem(Configuration.unix())) { Files.write(memoryFileSystem.getPath("/file.zip"), document); URI uri = URI.create("jar:" + memoryFileSystem.getPath("/file.zip").toUri()); Map