public final class ProgressFile extends Object
Constructor and Description |
---|
ProgressFile() |
Modifier and Type | Method and Description |
---|---|
static int |
getProgress(Path progressFile)
Returns the progress value read from the specified
progressFile
as an int. |
static int |
getProgress(String progressFilePath)
Returns the progress value read from the specified
progressFilePath as an int. |
static boolean |
isValidProgressValue(int value)
Returns a boolean that indicates whether the specified value is a valid
progress value.
|
static boolean |
setProgress(Path progressFile,
int value)
Write the specified
value to the given progressFilePath
if the value is between 0 and 100 included. |
static boolean |
setProgress(Path progressFile,
String value)
Write the specified
value to the given progressFilePath . |
static boolean |
setProgress(String progressFilePath,
int value)
Write the specified
value to the given progressFilePath
if the value is between 0 and 100 included. |
public static int getProgress(String progressFilePath)
progressFilePath
as an int.progressFilePath
- the absolute path to the progress file to read
from.-1
in case of error.public static int getProgress(Path progressFile)
progressFile
as an int.progressFile
- the progress file to read from.0
if the specified progressFile
does not exist or is empty, -1
in case of error.public static boolean isValidProgressValue(int value)
value
- the progress value to check.true
if the specified value is between 0
and
100
included, false
otherwise.public static boolean setProgress(String progressFilePath, int value)
value
to the given progressFilePath
if the value is between 0 and 100 included. Otherwise, nothing is
performed.progressFilePath
- the absolute path to the file to write the
progress value in.value
- the progress value, expected to be between 0 and
100 included.false
if the value is out of range or an IO exception
occurred, true
otherwise.public static boolean setProgress(Path progressFile, int value)
value
to the given progressFilePath
if the value is between 0 and 100 included. Otherwise, nothing is
performed.progressFile
- the path to the file to write the progress value in.value
- the progress value, expected to be between 0 and 100
included.false
if the value is out of range or an IO exception
occurred, true
otherwise.public static boolean setProgress(Path progressFile, String value)
value
to the given progressFilePath
.
No check is performed regarding the type of the value. This method is
mainly here for test purposes.progressFile
- the path to the file to write the progress value in.value
- the progress valuefalse
if an IO exception occurred, true
otherwise.