1 16 package org.apache.commons.vfs.provider.zip; 17 18 import org.apache.commons.vfs.Capability; 19 import org.apache.commons.vfs.FileName; 20 import org.apache.commons.vfs.FileObject; 21 import org.apache.commons.vfs.FileSystem; 22 import org.apache.commons.vfs.FileSystemException; 23 import org.apache.commons.vfs.FileSystemOptions; 24 import org.apache.commons.vfs.FileType; 25 import org.apache.commons.vfs.provider.AbstractLayeredFileProvider; 26 import org.apache.commons.vfs.provider.FileProvider; 27 import org.apache.commons.vfs.provider.LayeredFileName; 28 29 import java.util.Arrays ; 30 import java.util.Collection ; 31 import java.util.Collections ; 32 33 38 public class ZipFileProvider 39 extends AbstractLayeredFileProvider 40 implements FileProvider 41 { 42 protected final static Collection capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[] 43 { 44 Capability.GET_LAST_MODIFIED, 45 Capability.GET_TYPE, 46 Capability.LIST_CHILDREN, 47 Capability.READ_CONTENT, 48 Capability.URI, 49 Capability.COMPRESS, 50 Capability.VIRTUAL 51 })); 52 53 public ZipFileProvider() 54 { 55 super(); 56 } 57 58 66 protected FileSystem doCreateFileSystem(final String scheme, 67 final FileObject file, 68 final FileSystemOptions fileSystemOptions) 69 throws FileSystemException 70 { 71 final FileName rootName = 72 new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER); 73 return new ZipFileSystem(rootName, file, fileSystemOptions); 74 } 75 76 public Collection getCapabilities() 77 { 78 return capabilities; 79 } 80 } 81 | Popular Tags |