Class URLFileLocation


  • class URLFileLocation
    extends FileLocation
    The location of a file at a (remote) URL.
    Version:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String fileFullPath
      A prettied-up full path of the URL (password removed, etc.).
      private java.lang.String fileName
      A prettied-up filename (leading slash, and possibly "%2F", removed).
      private java.net.URL url
      URL of the remote file.
    • Constructor Summary

      Constructors 
      Constructor Description
      URLFileLocation​(java.net.URL url)
      Constructor.
    • Field Detail

      • url

        private java.net.URL url
        URL of the remote file.
      • fileFullPath

        private java.lang.String fileFullPath
        A prettied-up full path of the URL (password removed, etc.).
      • fileName

        private java.lang.String fileName
        A prettied-up filename (leading slash, and possibly "%2F", removed).
    • Constructor Detail

      • URLFileLocation

        URLFileLocation​(java.net.URL url)
        Constructor.
        Parameters:
        url - The URL of the file.
    • Method Detail

      • createFileFullPath

        private java.lang.String createFileFullPath()
        Creates a "prettied-up" URL to use. This will be stripped of sensitive information such as passwords.
        Returns:
        The full path to use.
      • createFileName

        private java.lang.String createFileName()
        Creates the "prettied-up" filename to use.
        Returns:
        The base name of the file of this URL.
      • getFileFullPath

        public java.lang.String getFileFullPath()
        Description copied from class: FileLocation
        Returns the full path to the file. This will be stripped of sensitive information such as passwords for remote files.
        Specified by:
        getFileFullPath in class FileLocation
        Returns:
        The full path to the file.
        See Also:
        FileLocation.getFileName()
      • getInputStream

        protected java.io.InputStream getInputStream()
                                              throws java.io.IOException
        Description copied from class: FileLocation
        Opens an input stream for reading from this file.
        Specified by:
        getInputStream in class FileLocation
        Returns:
        The input stream.
        Throws:
        java.io.IOException - If the file does not exist, or some other IO error occurs.
      • getOutputStream

        protected java.io.OutputStream getOutputStream()
                                                throws java.io.IOException
        Description copied from class: FileLocation
        Opens an output stream for writing this file.
        Specified by:
        getOutputStream in class FileLocation
        Returns:
        An output stream.
        Throws:
        java.io.IOException - If an IO error occurs.
      • isLocal

        public boolean isLocal()
        Returns whether this file location is a local file.
        Specified by:
        isLocal in class FileLocation
        Returns:
        Whether this is a local file.
        See Also:
        isLocalAndExists()
      • isLocalAndExists

        public boolean isLocalAndExists()
        Returns whether this file location is a local file and already exists. This method always returns false since we cannot check this value easily.
        Specified by:
        isLocalAndExists in class FileLocation
        Returns:
        false always.
        See Also:
        isLocal()