java - Write to Zip File System with other fs open -


I want to Hba static path attributes to scan for kids files, and this path refers to a zip file And I will not stop it because it will be randomly referenced at some points in the zip file I would write in. The problem is that I do not want to close the file system because the path property needs to open for future readings, and if I do not turn it off I can not see the written changes. If I try to create another file system that refers to the same file then I get FileSystemAlreadyExistsException. After writing, I can close the FS and then open it again, but someone can try to read the path at this time. Is there an alternative solution? Why do not I need to close the default file system to see the written files and I need it with a zip file system?

  public static void copyTree (Last path sources, the final path Lcshypth) throws IOException {filesystem FS = file system .getFileSystem (targetPath.toi)); Files.walkFileTree (source, new SimpleFileVisitor & lt; Path & gt; () {@Override public FileVisitResult preVisitDirectory (path directory, BasicFileAttributes attrs) throws IOException {Files.copy (dir, targetPath, StandardCopyOption.REPLACE_EXISTING); return super. preVisitDirectory (dir, attrs);} @ override Public file Vijitaristiklfail (path to the file, Besikfail properties) IOException {Files.copy (file Lcshypth, Mankcopioposn. REPLACE_EXISTING) throws; return super. visit file (file, etters); }}); // If I do not close the FileSystem here, the changes will not be visible. Fs.close (); }  

If you do not turn off "file system", you can close FILE - these things are completely different FileSystemAlreadyExistsException is only named sick - any file system is fully Java, AFAIK can not stop / unmounted, please use the word "filesystem" for files Stop it, its very confusing.

Answer your question to: If I had managed to understand it correctly, you were thinking that it is okay to access a file from a thread?

The most simple solution in that case: to the file in a new class, Class A and every write-mode make this type every write process will be blocked until the end of last - an additional method With the file that closes, you can also lock your application in a controlled way: You can also use Neo method calls which throw exceptions

I think that This small example for .property-file The extracts can be considered:


Comments