4

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

Suppose there is some code, which 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, which is very similar to java.io.File, to make the code refactoring easier.

Michael
  • 10,185
  • 12
  • 59
  • 110

2 Answers2

5

I haven't used it yet, but are you looking for the Zip File System Provider introduced in Java 7?

meriton
  • 68,356
  • 14
  • 108
  • 175
0

Zip File System Provider doesn't work as the abstraction layer exactly 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 by Christian Schlichtherle https://truevfs.java.net/ but it has its own issues.

darwinjob
  • 75
  • 1
  • 8