Supported File SystemsCommons VFS directly supports the following file systems with the listed capabilities:
Things from the sandboxThe following file systems are in development:
NamingAll filenames are treated as URIs. One of the consequences of this is you have to encode the '%'
character using %25. Examples
Many file systems accept a userid and password as part of the url. However, storing a password in clear text in a file is usually unacceptable. To help with that Commons VFS provides a mechanism to encrypt the password. It should be noted though, that this is not completely secure since the password needs to be unencrypted before Commons VFS can use it. To create an encrypted password do: java -cp commons-vfs-2.0.jar org.apache.commons.vfs2.util.EncryptUtil encrypt mypasswordwhere mypassword is the password you want to encrypt. The result of this will be a single line of output containing uppercase hex characters. For example, java -cp commons-vfs-2.0.jar org.apache.commons.vfs2.util.EncryptUtil encrypt WontUBee9 D7B82198B272F5C93790FEB38A73C7B8Then cut the output returned and paste it into the URL as: https://testuser:{D7B82198B272F5C93790FEB38A73C7B8}@myhost.com/svn/repos/vfstest/trunkVFS treats a password enclosed in {} as being encrypted and will decrypt the password before using it. Local FilesProvides access to the files on the local physical file system. URI Format [file://] absolute-path Where absolute-path is a valid absolute file name for the local platform. UNC names are supported under Windows. Examples
Zip, Jar and TarProvides read-only access to the contents of Zip, Jar and Tar files. URI Format zip:// arch-file-uri[! absolute-path] jar:// arch-file-uri[! absolute-path] tar:// arch-file-uri[! absolute-path] tgz:// arch-file-uri[! absolute-path] tbz2:// arch-file-uri[! absolute-path]
Where
arch-file-uri refers to a file of any
supported type, including other zip files. Note: if you would like
to use the ! as normal character it must be escaped
using %21. Examples
gzip and bzip2Provides read-only access to the contents of gzip and bzip2 files. URI Format gz:// compressed-file-uri bz2:// compressed-file-uri Where compressed-file-uri refers to a file of any supported type. There is no need to add a ! part to the URI if you read the content of the file you always will get the uncompressed version. Examples
HDFSProvides (read-only) access to files in an Apache Hadoop File System (HDFS). On Windows the integration test is disabled by default, as it requires binaries. URI Format hdfs:// hostname[: port][ absolute-path] Examples
HTTP and HTTPSProvides access to files on an HTTP server. URI Format http://[ username[: password]@] hostname[: port][ absolute-path] https://[ username[: password]@] hostname[: port][ absolute-path] File System Options
Examples
WebDAVProvides access to files on a WebDAV server. URI Format webdav://[ username[: password]@] hostname[: port][ absolute-path] File System Options
Examples
FTPProvides access to the files on an FTP server. URI Format ftp://[ username[: password]@] hostname[: port][ relative-path] Examples
By default, the path is relative to the user's home directory. This can be changed with: FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(options, false); FTPSProvides access to the files on an FTP server over SSL. URI Format ftps://[ username[: password]@] hostname[: port][ absolute-path] Examples
SFTPProvides access to the files on an SFTP server (that is, an SSH or SCP server). URI Format sftp://[ username[: password]@] hostname[: port][ relative-path] Examples
By default, the path is relative to the user's home directory. This can be changed with: FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(options, false); CIFSThe CIFS (sandbox) filesystem provides access to a CIFS server, such as a Samba server, or a Windows share. URI Format smb://[ username[: password]@] hostname[: port][ absolute-path] Examples
Temporary FilesProvides access to a temporary file system, or scratchpad, that is deleted when Commons VFS shuts down. The temporary file system is backed by a local file system. URI Format tmp://[ absolute-path] Examples
resThis is not really a filesystem, it just tries to lookup a resource using javas ClassLoader.getResource() and creates a VFS url for further processing. URI Format res://[ path] Examples
ramA filesystem which stores all the data in memory (one byte array for each file content). URI Format ram://[ path] File System Options
Examples
mime
This (sandbox) filesystem can read mails and its attachements like archives. URI Format mime:// mime-file-uri[! absolute-path] Examples
|