1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider.tar;
18
19 import java.util.Arrays;
20 import java.util.Collection;
21 import java.util.Collections;
22
23 import org.apache.commons.vfs2.Capability;
24 import org.apache.commons.vfs2.FileName;
25 import org.apache.commons.vfs2.FileObject;
26 import org.apache.commons.vfs2.FileSystem;
27 import org.apache.commons.vfs2.FileSystemException;
28 import org.apache.commons.vfs2.FileSystemOptions;
29 import org.apache.commons.vfs2.FileType;
30 import org.apache.commons.vfs2.provider.AbstractFileName;
31 import org.apache.commons.vfs2.provider.AbstractLayeredFileProvider;
32 import org.apache.commons.vfs2.provider.LayeredFileName;
33
34
35
36
37 public class TarFileProvider extends AbstractLayeredFileProvider {
38
39
40 protected static final Collection<Capability> capabilities = Collections
41 .unmodifiableCollection(Arrays.asList(Capability.GET_LAST_MODIFIED, Capability.GET_TYPE, Capability.LIST_CHILDREN,
42 Capability.READ_CONTENT, Capability.URI, Capability.VIRTUAL));
43
44 public TarFileProvider() {
45 }
46
47
48
49
50
51
52
53
54 @Override
55 protected FileSystem doCreateFileSystem(final String scheme, final FileObject file,
56 final FileSystemOptions fileSystemOptions) throws FileSystemException {
57 final AbstractFileName rootName = new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH,
58 FileType.FOLDER);
59 return new TarFileSystem(rootName, file, fileSystemOptions);
60 }
61
62 @Override
63 public Collection<Capability> getCapabilities() {
64 return capabilities;
65 }
66 }