2012-02-12 40 views
4

是否有Java庫,它通過文件系統和jar/zip提供了抽象層。我檢查了apache common vfs,但它不支持諸如爲Jar/Zip列出目錄內容和文件重命名之類的操作。文件系統上的抽象層和Java中的jar/zip

假設有一些代碼,它使用java.io.File及其朋友訪問文件系統中的文件,如果這些文件在Jar/Zip中,我需要使其工作。我想找到一個非常類似於java.io.File的API,以使代碼重構更容易。

回答

0

Zip文件系統提供程序不作爲抽象層,因爲java.io.File中的工作完全:

public class ZipPath implements Path { 

@Override 
public final File toFile() { 
    throw new UnsupportedOperationException(); 
    } 
} 

我能找到的最接近的API是由基督教Schlichtherle https://truevfs.java.net/ TrueZIP/TrueVFS但它有它的自己的問題。