Naming

All filenames are treated as URIs. One of the consequences of this is you have to encode the '%' character using %25.

Depending on the filesystem additional characters are encoded if needet. This is done automatically, but might be reflected in the filename.

Examples

  • file:///somedir/some%25file.txt

Local Files

Provides 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

  • file:///home/someuser/somedir
  • file://C:/Documents and Settings
  • file:////somehost/someshare/afile.txt
  • /home/someuser/somedir
  • c:\program files\some dir
  • c:/program files/some dir

Zip, Jar and Tar

Provides 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.

tgz and tbz2 are convenience for tar:gz and tar:bz2.

Examples

  • jar:../lib/classes.jar!/META-INF/manifest.mf
  • zip:http://somehost/downloads/somefile.zip
  • jar:zip:outer.zip!/nested.jar!/somedir
  • jar:zip:outer.zip!/nested.jar!/some%21dir
  • tar:gz:http://anyhost/dir/mytar.tar.gz!/mytar.tar!/path/in/tar/README.txt
  • tgz:file://anyhost/dir/mytar.tgz!/somepath/somefile

gzip and bzip2

Provides 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

  • gz:/my/gz/file.gz

HTTP and HTTPS

Provides access to files on an HTTP server.

URI Format

http://[ username[: password]@] hostname[: port][ absolute-path]

https://[ username[: password]@] hostname[: port][ absolute-path]

Examples

  • http://somehost:8080/downloads/somefile.jar
  • http://myusername@somehost/index.html

WebDAV

Provides access to files on a WebDAV server.

URI Format

webdav://[ username[: password]@] hostname[: port][ absolute-path]

Examples

  • webdav://somehost:8080/dist

FTP

Provides access to the files on an FTP server.

URI Format

ftp://[ username[: password]@] hostname[: port][ absolute-path]

Examples

  • ftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz

SFTP

Provides access to the files on an SFTP server (that is, an SSH or SCP server).

URI Format

sftp://[ username[: password]@] hostname[: port][ absolute-path]

Examples

  • sftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz

CIFS

Provides access to the files on a CIFS server, such as a Samba server, or a Windows share.

URI Format

smb://[ username[: password]@] hostname[: port][ absolute-path]

Examples

  • smb://somehost/home

Temporary Files

Provides 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

  • tmp://dir/somefile.txt

res

This is not really a filesystem, it just tries to lookup a resource using javas ClassLoader.getResource() and creates a VFS url for further processing.

RES Format

res://[ path]

Examples

  • res:path/in/classpath/image.png

    might result in jar:file://my/path/to/images.jar!/path/in/classpath/image.png