Class DataLocation
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.aozan3.DataLocation
-
public class DataLocation extends Object
This class define a data location- Since:
- 3.0
- Author:
- Laurent Jourdren
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DataLocation.Format
Format of the data location
-
Constructor Summary
Constructors Constructor Description DataLocation(DataStorage storage, Path path)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIfDirectory()
Check if the data location is a directory.void
checkIfDirectory(String errorMessage)
Check if the data location is a directory.void
checkIfExists()
Check if the data location exists.void
checkIfExists(String errorMessage)
Check if the data location exists.void
checkIfFile()
Check if the data location is a directory.void
checkIfFile(String errorMessage)
Check if the data location is a directory.void
checkIfNotExists()
Check if the data location not exists.void
checkIfNotExists(String errorMessage)
Check if the data location not exists.void
checkIfReadable()
Check if the data location is readable.void
checkIfReadable(String errorMessage)
Check if the data location is readable.void
checkIfWritable()
Check if the data location is writable.void
checkIfWritable(String errorMessage)
Check if the data location is writable.void
checkReadableDirectory(String directoryType)
Check if the data location is a readable directory.void
checkReadableFile(String fileType)
Check if the data location is a readable file.void
checkWritableDirectory(String directoryType)
Check if the data location is a writable directory.void
checkWritableFile(String fileType)
Check if the data location is a writable file.boolean
exist()
Test if the data location exists.boolean
exists()
Test if the data location exists.long
getDiskUsage()
Get the disk usage of the data location.DataLocation.Format
getFormat()
Get the format of the data.Path
getPath()
Get the path of the data.DataStorage
getStorage()
Get the storage of the data location.boolean
isDirectory()
Test if the data location is a directory.boolean
isFile()
Test if the data location is a regular file.boolean
isReadable()
Test if the data location is readable.boolean
isWriteable()
Test if the data location is writable.String
toString()
-
-
-
Constructor Detail
-
DataLocation
public DataLocation(DataStorage storage, Path path)
Public constructor.- Parameters:
storage
- storage of the data locationpath
- 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
-
-