Class VfsResource

  • All Implemented Interfaces:
    Resource

    public class VfsResource
    extends java.lang.Object
    implements Resource
    VFS implementation of the Resource interface
    • Constructor Summary

      Constructors 
      Constructor Description
      VfsResource​(java.lang.String vfsURI, org.apache.commons.vfs2.FileSystemManager fsManager)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Resource clone​(java.lang.String cloneName)
      Clones this resource with a new resource with a different name
      boolean exists()
      Flag indicating whether a resource is available for querying
      java.util.List<java.lang.String> getChildren()
      Get a list of direct descendants of the given resource.
      org.apache.commons.vfs2.FileContent getContent()  
      long getContentLength()
      Get the size of the resource
      long getLastModified()
      Get the last modification time of the resource.
      java.lang.String getName()
      Get the name of the resource.
      boolean isLocal()
      Is this resource local to this host, i.e.
      static java.lang.String normalize​(java.lang.String vfsURI)
      The VFS FileName getURI method seems to have a bug in it where file: URIs will have 4 forward slashes instead of 3.
      java.io.InputStream openStream()
      Opens a stream on this resource
      boolean physicallyExists()
      Return a flag indicating whether a provided VFS resource physically exists
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • VfsResource

        public VfsResource​(java.lang.String vfsURI,
                           org.apache.commons.vfs2.FileSystemManager fsManager)
    • Method Detail

      • getChildren

        public java.util.List<java.lang.String> getChildren()
        Get a list of direct descendants of the given resource. Note that attempts to get a list of children does not result in an error. Instead an error message is logged and an empty ArrayList returned.
        Returns:
        A ArrayList of VFSResources
      • getContent

        public org.apache.commons.vfs2.FileContent getContent()
      • getName

        public java.lang.String getName()
        Get the name of the resource.
        Specified by:
        getName in interface Resource
        Returns:
        a String representing the Resource URL.
      • clone

        public Resource clone​(java.lang.String cloneName)
        Description copied from interface: Resource
        Clones this resource with a new resource with a different name
        Specified by:
        clone in interface Resource
        Parameters:
        cloneName - the name of the clone
        Returns:
        the cloned resource
      • normalize

        public static java.lang.String normalize​(java.lang.String vfsURI)
        The VFS FileName getURI method seems to have a bug in it where file: URIs will have 4 forward slashes instead of 3.
        Parameters:
        vfsURI - ditto
        Returns:
        a normalized String representing the VFS URI
      • getLastModified

        public long getLastModified()
        Get the last modification time of the resource.
        Specified by:
        getLastModified in interface Resource
        Returns:
        a long indicating last modified time.
      • getContentLength

        public long getContentLength()
        Get the size of the resource
        Specified by:
        getContentLength in interface Resource
        Returns:
        a long representing the size of the resource (in bytes).
      • exists

        public boolean exists()
        Flag indicating whether a resource is available for querying
        Specified by:
        exists in interface Resource
        Returns:
        true if the resource is available for querying, false otherwise.
      • physicallyExists

        public boolean physicallyExists()
        Return a flag indicating whether a provided VFS resource physically exists
        Returns:
        true if the resource physically exists, false otherwise.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isLocal

        public boolean isLocal()
        Description copied from interface: Resource
        Is this resource local to this host, i.e. is it on the file system?
        Specified by:
        isLocal in interface Resource
        Returns:
        boolean value indicating if the resource is local.
      • openStream

        public java.io.InputStream openStream()
                                       throws java.io.IOException
        Description copied from interface: Resource
        Opens a stream on this resource
        Specified by:
        openStream in interface Resource
        Returns:
        the opened input stream
        Throws:
        java.io.IOException - if something goes wrong