I am new to Commons VFS and am trying to understand how to open a nested archive. I found an example in the source code that deals with this. This test passes.
@Test
void testTGZ() throws Exception {
FileSystemManager fsManager = VFS.getManager();
String uri = "tgz:file:///c:/data/nested.tgz!/test.tgz";
FileObject archive = fsManager.resolveFile(uri);
FileObject nestedFs = fsManager.createFileSystem(archive);
// List the children of the archive file
FileObject[] children = nestedFs.getChildren();
for (FileObject child : children) {
System.out.println(child.getURI());
}
}
whereas this one fails with
org.apache.commons.vfs2.FileSystemException: Could not find a file provider that can handle file "tgz:file:///C:/data/nested.tar.gz!/test.tar.gz".
@Test
void testTarGZ() throws Exception {
FileSystemManager fsManager = VFS.getManager();
String uri = "tgz:file:///c:/data/nested.tar.gz!/test.tar.gz";
FileObject archive = fsManager.resolveFile(uri);
FileObject nestedFs = fsManager.createFileSystem(archive);
// List the children of the archive file
FileObject[] children = nestedFs.getChildren();
for (FileObject child : children) {
System.out.println(child.getURI());
}
}
Other than the names the files are the same so why would one work and not the other? What am I doing wrong?