Class URLDataProtocol

    • Constructor Detail

      • URLDataProtocol

        public URLDataProtocol()
    • Method Detail

      • getData

        public InputStream getData​(DataFile src)
                            throws IOException
        Description copied from interface: DataProtocol
        Create an InputStream from the source.
        Parameters:
        src - source to use
        Returns:
        an InputStream
        Throws:
        IOException - if an error occurs while creating the InputStream
      • putData

        public OutputStream putData​(DataFile src)
                             throws IOException
        Description copied from interface: DataProtocol
        Create an OutputStream from the source.
        Parameters:
        src - destination to use
        Returns:
        an OutputStream
        Throws:
        IOException - if an error occurs while creating the OutputStream
      • getMetadata

        public DataFileMetadata getMetadata​(DataFile src)
                                     throws IOException
        Description copied from interface: DataProtocol
        Get the metadata for the source.
        Parameters:
        src - source to use
        Returns:
        always a metadataObject
        Throws:
        IOException - if an error occurs while getting metadata
      • canRead

        public boolean canRead()
        Description copied from interface: DataProtocol
        Test if source is readable with this protocol.
        Returns:
        true if the source is readable
      • canWrite

        public boolean canWrite()
        Description copied from interface: DataProtocol
        Test if source is writable with this protocol.
        Returns:
        true if the source is writable
      • exists

        public boolean exists​(DataFile src,
                              boolean followLink)
        Description copied from interface: DataProtocol
        Test a source exists.
        Parameters:
        src - source to use
        followLink - if the source is a symbolic file and followLink is true, it will check if the symbolic link target exists instead of the link
        Returns:
        true if the source exists
      • getSourceFilename

        public String getSourceFilename​(String source)
        Description copied from interface: DataProtocol
        Get the name of the filename that correspond to the source.
        Specified by:
        getSourceFilename in interface DataProtocol
        Parameters:
        source - the source
        Returns:
        a String with the filename
      • getDataFileParent

        public DataFile getDataFileParent​(DataFile src)
        Description copied from interface: DataProtocol
        Get the parent source of the source.
        Specified by:
        getDataFileParent in interface DataProtocol
        Parameters:
        src - source to use
        Returns:
        a String with the source of the parent or null if there is parent
      • putData

        public void putData​(DataFile src,
                            DataFile dest)
                     throws IOException
        Description copied from interface: DataProtocol
        Copy data from a source to a destination source
        Specified by:
        putData in interface DataProtocol
        Parameters:
        src - source source
        dest - destination source
        Throws:
        IOException - if an error occurs while copying data
      • getSourceAsFile

        public File getSourceAsFile​(DataFile src)
        Description copied from interface: DataProtocol
        Get the underlying File object for the DataFile if the protocol allow it.
        Specified by:
        getSourceAsFile in interface DataProtocol
        Returns:
        a File object or null if the protocol does not allow it
      • mkdirs

        public void mkdirs​(DataFile dir)
                    throws IOException
        Description copied from interface: DataProtocol
        Create a directory and its parents if not exists.
        Specified by:
        mkdirs in interface DataProtocol
        Parameters:
        dir - directory to create
        Throws:
        IOException - if an error occurs while creating the directory
      • canMkdir

        public boolean canMkdir()
        Description copied from interface: DataProtocol
        Test if the mkdir() and mkdirs() methods are available with this protocol.
        Specified by:
        canMkdir in interface DataProtocol
        Returns:
        true if mkdir() and mkdirs() are available
      • canSymlink

        public boolean canSymlink()
        Description copied from interface: DataProtocol
        Test if the symlink() method is available with this protocol.
        Specified by:
        canSymlink in interface DataProtocol
        Returns:
        true if symlink() is available
      • delete

        public void delete​(DataFile file,
                           boolean recursive)
                    throws IOException
        Description copied from interface: DataProtocol
        Delete a file.
        Specified by:
        delete in interface DataProtocol
        Parameters:
        file - file to delete
        recursive - recursive deletion
        Throws:
        IOException - if an error occurs while deleting the file
      • canDelete

        public boolean canDelete()
        Description copied from interface: DataProtocol
        Test if the delete() method is available with this protocol.
        Specified by:
        canDelete in interface DataProtocol
        Returns:
        true if delete() is available
      • canList

        public boolean canList()
        Description copied from interface: DataProtocol
        Test if the list() method is available with this protocol.
        Specified by:
        canList in interface DataProtocol
        Returns:
        true if list() is available
      • canRename

        public boolean canRename()
        Description copied from interface: DataProtocol
        Test if the renameTo() method is available with this protocol.
        Specified by:
        canRename in interface DataProtocol
        Returns:
        true if renameTo() is available
      • rename

        public void rename​(DataFile oldName,
                           DataFile newName)
                    throws IOException
        Description copied from interface: DataProtocol
        Rename a file.
        Specified by:
        rename in interface DataProtocol
        Parameters:
        oldName - the file to rename
        newName - the destination file
        Throws:
        IOException - if an error occurs while renaming the directory