public class Timers
extends java.lang.Object
Constructor and Description |
---|
Timers() |
Modifier and Type | Method and Description |
---|---|
static int |
convertFromMinuteFormat(java.lang.String value)
Converts from
MM:SS or M:SS to seconds |
static java.lang.String |
convertToMinuteFormat(int totalSecs)
Converts from seconds to
MM:SS format |
int |
get()
Gets the current value of
timer.txt . |
int |
getInitialTimerLength()
Gets the total length of the timer.
|
void |
set(int seconds)
Set the current value of the timer
|
void |
setInitialTimerLength(int seconds)
Sets the value the timer will go to on initial start, or after a restart or stop
|
void |
setInitialTimerTwoLength(int seconds) |
public void setInitialTimerLength(int seconds) throws java.io.IOException, java.lang.IllegalArgumentException
seconds
- a positive integerjava.io.IOException
java.lang.IllegalArgumentException
getInitialTimerLength()
public void setInitialTimerTwoLength(int seconds)
public int getInitialTimerLength()
setInitialTimerLength(int)
public void set(int seconds) throws java.io.IOException
seconds
- a second value (non-negative)java.io.IOException
- if any I/O error occurs when accessing Timer.txtpublic int get() throws java.io.IOException
timer.txt
.
If the timer file is empty or invalid, the default timer will be retrievedjava.io.FileNotFoundException
- timer.txt cannot be foundjava.io.IOException
public static java.lang.String convertToMinuteFormat(int totalSecs)
MM:SS
formattotalSecs
- M:SS
if totalSecs < 60
, else MM:SS
public static int convertFromMinuteFormat(java.lang.String value)
MM:SS
or M:SS
to secondsvalue
-