org.millscript.commons.vfs
Class VFS

java.lang.Object
  extended by org.millscript.commons.vfs.VFS
All Implemented Interfaces:
URISchemeHandler

public class VFS
extends java.lang.Object
implements URISchemeHandler

This class provides the entry point for obtaining a new virtual filesytem.


Constructor Summary
VFS()
           
 
Method Summary
 VFolder getCurrentWorkingFolder()
          Returns the virtual folder for the current working folder.
 java.nio.charset.Charset getDefaultCharset()
          Returns the default character set this VFS will use for reading and writing file contents.
 VFS getParentVFS()
          Returns the parent VFS, that which created this URI scheme handler.
 URISchemeHandlerFactory getURISchemeHandlerFactory()
          Returns the current URI scheme hander factory.
 VFile resolveAsFile(java.net.URI uri)
          Resolves the specified URI to a virtual file in a new virtual filesystem.
 VFolder resolveAsFolder(java.net.URI uri)
          Resolves the specified URI to a virtual fole in a new virtual filesystem.
 VVolume resolveAsVolume(java.net.URI uri)
          Resolves the specified URI to a new virtual filesystem volume.
 void setDefaultCharset(java.nio.charset.Charset charset)
          Sets the default character set this VFS will use for reading and writing file contents.
 void setURISchemeHandlerFactory(URISchemeHandlerFactory f)
          Sets the URI scheme handler factory that should be used for resolving URI schemes to VFS protocols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VFS

public VFS()
Method Detail

getCurrentWorkingFolder

public VFolder getCurrentWorkingFolder()
Returns the virtual folder for the current working folder. The current working folder is determined via the user.dir system property.

Returns:
a VFolder for the current working folder

getDefaultCharset

public java.nio.charset.Charset getDefaultCharset()
Returns the default character set this VFS will use for reading and writing file contents.

Returns:
the default character set this VFS will use

getParentVFS

public VFS getParentVFS()
Description copied from interface: URISchemeHandler
Returns the parent VFS, that which created this URI scheme handler. The parent VFS is maintained through to each volume, so that we can use it for configuration.

Specified by:
getParentVFS in interface URISchemeHandler
Returns:
See Also:
URISchemeHandler.getParentVFS()

getURISchemeHandlerFactory

public URISchemeHandlerFactory getURISchemeHandlerFactory()
Returns the current URI scheme hander factory.

Returns:
the current URISchemeHandlerFactory

resolveAsFile

public final VFile resolveAsFile(java.net.URI uri)
Description copied from interface: URISchemeHandler
Resolves the specified URI to a virtual file in a new virtual filesystem. The returned virtual file will belong to a virtual volume and possibly some virtual folders as well. The virtual volume will be located at the root of the URI's path.

Specified by:
resolveAsFile in interface URISchemeHandler
Parameters:
uri - the URI of the file to get a virtual file for
Returns:
a VFile for the specified file URI
See Also:
URISchemeHandler.resolveAsFile(java.net.URI)

resolveAsFolder

public final VFolder resolveAsFolder(java.net.URI uri)
Description copied from interface: URISchemeHandler
Resolves the specified URI to a virtual fole in a new virtual filesystem. The returned virtual fiolder will belong to a virtual volume and possibly some virtual folders as well. The virtual volume will be located at the root of the URI's path.

Specified by:
resolveAsFolder in interface URISchemeHandler
Parameters:
uri - the URI of the folder to get a virtual folder for
Returns:
a VFile for the specified folder URI
See Also:
URISchemeHandler.resolveAsFolder(java.net.URI)

resolveAsVolume

public final VVolume resolveAsVolume(java.net.URI uri)
Description copied from interface: URISchemeHandler
Resolves the specified URI to a new virtual filesystem volume. The root of the virtual volume will be the specified URI's path.

Specified by:
resolveAsVolume in interface URISchemeHandler
Parameters:
uri - the URI of the file to get a virtual file for
Returns:
a VFile for the specified file URI
See Also:
URISchemeHandler.resolveAsVolume(java.net.URI)

setDefaultCharset

public void setDefaultCharset(java.nio.charset.Charset charset)
Sets the default character set this VFS will use for reading and writing file contents.

Parameters:
charset - the default character set this VFS should use

setURISchemeHandlerFactory

public void setURISchemeHandlerFactory(URISchemeHandlerFactory f)
Sets the URI scheme handler factory that should be used for resolving URI schemes to VFS protocols.

Parameters:
f - the new URISchemeHandlerFactor to use


Copyright © 2005-2007 Open World Ltd. All Rights Reserved.