Class DataLocation


  • public class DataLocation
    extends Object
    This class define a data location
    Since:
    3.0
    Author:
    Laurent Jourdren
    • Constructor Detail

      • DataLocation

        public DataLocation​(DataStorage storage,
                            Path path)
        Public constructor.
        Parameters:
        storage - storage of the data location
        path - path of the data location
    • Method Detail

      • exists

        public boolean exists()
        Test if the data location exists.
        Returns:
        true if the data location exists
      • getStorage

        public DataStorage getStorage()
        Get the storage of the data location.
        Returns:
        the data storage
      • getPath

        public Path getPath()
        Get the path of the data.
        Returns:
        the path of the data
      • getFormat

        public DataLocation.Format getFormat()
        Get the format of the data.
        Returns:
        the format of the data
      • isDirectory

        public boolean isDirectory()
        Test if the data location is a directory.
        Returns:
        true if the data location is a directory
      • checkIfDirectory

        public void checkIfDirectory​(String errorMessage)
                              throws IOException
        Check if the data location is a directory.
        Parameters:
        errorMessage - error message to set in the exception message
        Throws:
        IOException - if the data location is not a directory
      • checkIfDirectory

        public void checkIfDirectory()
                              throws IOException
        Check if the data location is a directory.
        Throws:
        IOException - if the data location is not a directory
      • isFile

        public boolean isFile()
        Test if the data location is a regular file.
        Returns:
        true if the data location is a file
      • checkIfFile

        public void checkIfFile​(String errorMessage)
                         throws IOException
        Check if the data location is a directory.
        Parameters:
        errorMessage - error message to set in the exception message
        Throws:
        IOException - if the data location is not a directory
      • checkIfFile

        public void checkIfFile()
                         throws IOException
        Check if the data location is a directory.
        Throws:
        IOException - if the data location is not a directory
      • exist

        public boolean exist()
        Test if the data location exists.
        Returns:
        true if the data location exists
      • checkIfExists

        public void checkIfExists​(String errorMessage)
                           throws IOException
        Check if the data location exists.
        Parameters:
        errorMessage - error message to set in the exception message
        Throws:
        IOException - if the data location exists
      • checkIfExists

        public void checkIfExists()
                           throws IOException
        Check if the data location exists.
        Throws:
        IOException - if the data location exists
      • checkIfNotExists

        public void checkIfNotExists​(String errorMessage)
                              throws IOException
        Check if the data location not exists.
        Parameters:
        errorMessage - error message to set in the exception message
        Throws:
        IOException - if the data location not exists
      • checkIfNotExists

        public void checkIfNotExists()
                              throws IOException
        Check if the data location not exists.
        Throws:
        IOException - if the data location not exists
      • isReadable

        public boolean isReadable()
        Test if the data location is readable.
        Returns:
        true if the data location is readable
      • checkIfReadable

        public void checkIfReadable​(String errorMessage)
                             throws IOException
        Check if the data location is readable.
        Parameters:
        errorMessage - error message to set in the exception message
        Throws:
        IOException - if the data location is readable
      • checkIfReadable

        public void checkIfReadable()
                             throws IOException
        Check if the data location is readable.
        Throws:
        IOException - if the data location is readable
      • isWriteable

        public boolean isWriteable()
        Test if the data location is writable.
        Returns:
        true if the data location is writable
      • checkIfWritable

        public void checkIfWritable​(String errorMessage)
                             throws IOException
        Check if the data location is writable.
        Parameters:
        errorMessage - error message to set in the exception message
        Throws:
        IOException - if the data location is writable
      • checkIfWritable

        public void checkIfWritable()
                             throws IOException
        Check if the data location is writable.
        Throws:
        IOException - if the data location is writable
      • checkReadableDirectory

        public void checkReadableDirectory​(String directoryType)
                                    throws IOException
        Check if the data location is a readable directory.
        Parameters:
        directoryType - message in the exception
        Throws:
        IOException - if the data location is not is a readable directory
      • checkWritableDirectory

        public void checkWritableDirectory​(String directoryType)
                                    throws IOException
        Check if the data location is a writable directory.
        Parameters:
        directoryType - message in the exception
        Throws:
        IOException - if the data location is not is a writable directory
      • checkReadableFile

        public void checkReadableFile​(String fileType)
                               throws IOException
        Check if the data location is a readable file.
        Parameters:
        fileType - message in the exception
        Throws:
        IOException - if the data location is not is a readable file
      • checkWritableFile

        public void checkWritableFile​(String fileType)
                               throws IOException
        Check if the data location is a writable file.
        Parameters:
        fileType - message in the exception
        Throws:
        IOException - if the data location is not is a writable file
      • getDiskUsage

        public long getDiskUsage()
                          throws IOException
        Get the disk usage of the data location.
        Returns:
        the disk usage in bytes
        Throws:
        IOException