Package gw.fs.url

Class URLFileImpl

  • All Implemented Interfaces:
    IFile, IResource

    public class URLFileImpl
    extends java.lang.Object
    implements IFile
    HTTP-backed file. The only supported operation is to open stream.
    • Field Detail

      • _url

        private java.net.URL _url
    • Constructor Detail

      • URLFileImpl

        public URLFileImpl​(java.net.URL url)
    • Method Detail

      • openInputStream

        public java.io.InputStream openInputStream()
                                            throws java.io.IOException
        Specified by:
        openInputStream in interface IFile
        Throws:
        java.io.IOException
      • openOutputStream

        public java.io.OutputStream openOutputStream()
                                              throws java.io.IOException
        Specified by:
        openOutputStream in interface IFile
        Throws:
        java.io.IOException
      • openOutputStreamForAppend

        public java.io.OutputStream openOutputStreamForAppend()
                                                       throws java.io.IOException
        Specified by:
        openOutputStreamForAppend in interface IFile
        Throws:
        java.io.IOException
      • getExtension

        public java.lang.String getExtension()
        Specified by:
        getExtension in interface IFile
      • getBaseName

        public java.lang.String getBaseName()
        Specified by:
        getBaseName in interface IFile
      • getParent

        public IDirectory getParent()
        Description copied from interface: IResource
        Gets this file's our directory's parent directory.
        Specified by:
        getParent in interface IResource
        Returns:
        this resource's parent directory
      • getName

        public java.lang.String getName()
        Description copied from interface: IResource
        Gets this file's or directory's name.
        Specified by:
        getName in interface IResource
        Returns:
        this resource's name
      • exists

        public boolean exists()
        Description copied from interface: IResource
        Indicates whether this resource exists.
        Specified by:
        exists in interface IResource
        Returns:
        true if the resource exists
      • delete

        public boolean delete()
                       throws java.io.IOException
        Specified by:
        delete in interface IResource
        Throws:
        java.io.IOException
      • toURI

        public java.net.URI toURI()
        Specified by:
        toURI in interface IResource
      • isChildOf

        public boolean isChildOf​(IDirectory dir)
        Description copied from interface: IResource
        Indicates whether this resource is a direct child of the given directory.
        Specified by:
        isChildOf in interface IResource
        Parameters:
        dir - the directory which would be the parent
        Returns:
        true if this is a direct child of the given directory
      • isDescendantOf

        public boolean isDescendantOf​(IDirectory dir)
        Description copied from interface: IResource
        Indicates whether this resource is a descendant of the given directory.
        Specified by:
        isDescendantOf in interface IResource
        Parameters:
        dir - the directory which would be the ancestor
        Returns:
        true if this is a descendant of the given directory
      • toJavaFile

        public java.io.File toJavaFile()
        Specified by:
        toJavaFile in interface IResource
      • isInJar

        public boolean isInJar()
        Specified by:
        isInJar in interface IResource
      • create

        public boolean create()
        Specified by:
        create in interface IResource