Class Duration
- java.lang.Object
-
- com.rometools.modules.itunes.types.Duration
-
- All Implemented Interfaces:
Serializable
public class Duration extends Object implements Serializable
An encapsulation of the duration of a podcast. This will serialize (via .toString()) to HH:MM:SS format, and can parse [H]*H:[M]*M:[S]*S or [M]*M:[S]*S.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Duration()Creates a new Duration object with 0 length.Duration(int hours, int minutes, float seconds)Creates a new duration object with the given hours, minutes and secondsDuration(long milliseconds)Creates a new instance of Duration specifying a length in millisecondsDuration(String duration)Creates a new Duration parsing the String value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetMilliseconds()Returns the millisecond lengthvoidsetMilliseconds(long milliseconds)Sets the millisecond lengthStringtoString()Returns a String representation in the formation HH:MM:SS
-
-
-
Constructor Detail
-
Duration
public Duration()
Creates a new Duration object with 0 length.
-
Duration
public Duration(long milliseconds)
Creates a new instance of Duration specifying a length in milliseconds- Parameters:
milliseconds- Creates a new instance of Duration specifying a length in milliseconds
-
Duration
public Duration(int hours, int minutes, float seconds)Creates a new duration object with the given hours, minutes and seconds- Parameters:
hours- number of hoursminutes- number of minutesseconds- number of seconds
-
Duration
public Duration(String duration)
Creates a new Duration parsing the String value.- Parameters:
duration- A String to parse
-
-
Method Detail
-
toString
public String toString()
Returns a String representation in the formation HH:MM:SS
-
getMilliseconds
public long getMilliseconds()
Returns the millisecond length- Returns:
- the millisecond length
-
setMilliseconds
public void setMilliseconds(long milliseconds)
Sets the millisecond length- Parameters:
milliseconds- the millisecond length
-
-