Abstraction level over file system and jar / zip in Java

Is there a Java library that provides an abstraction layer over the file system and jar / zip. I checked apache common vfs , but does not support operations such as listing the contents of a directory and renaming a file for Jar / Zip.

Suppose there is some code that uses java.io.File and its friends to access files in the file system, and I need to make it work if these files are in Jar / Zip. I would like to find an API that is very similar to java.io.File in order to simplify code reorganization.

+4
source share
2 answers

I haven't used it yet, but are you looking for a zip file system provider introduced in Java 7?

+5
source

The Zip file system provider does not work as an abstraction layer precisely because of java.io.File:

 public class ZipPath implements Path { @Override public final File toFile() { throw new UnsupportedOperationException(); } } 

The closest API I could find is TrueZIP / TrueVFS from Christian Schlichtherle https://truevfs.java.net/ , but it has its problems.

0
source

Source: https://habr.com/ru/post/1396044/


All Articles