Class TimeCode

java.lang.Object
se.datadosen.jalbum.TimeCode
All Implemented Interfaces:
com.github.cliftonlabs.json_simple.Jsonable, java.io.Serializable, java.lang.Comparable<TimeCode>

public class TimeCode
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<TimeCode>, com.github.cliftonlabs.json_simple.Jsonable
Represents time measurements used by VideoProcessor
Since:
v11
See Also:
Serialized Form
  • Constructor Summary

    Constructors 
    Constructor Description
    TimeCode()  
    TimeCode​(int secs)  
    TimeCode​(int secs, int millis)  
    TimeCode​(java.lang.String s)
    Parse a time code formatted as hh:mm:ss.ff, hh:mm:ss.xxx or hh:mm:ss as a TimeCode (xxx represents fractions of a second, so .1 means a tenth of a second)
  • Method Summary

    Modifier and Type Method Description
    long asMillis()  
    int compareTo​(TimeCode o)  
    boolean equals​(java.lang.Object obj)  
    static TimeCode fromMillis​(long millis)  
    int getMillis()  
    int getSecs()  
    int hashCode()  
    void setFrames​(int frames)
    Deprecated.
    Use setMillis.
    void setMillis​(int millis)  
    void setSecs​(int secs)  
    java.lang.String toJson()  
    void toJson​(java.io.Writer writable)  
    java.lang.String toShortString()  
    java.lang.String toString()
    Return TimeCode formatted as h:m:ss or m:ss.xxx if there are frames too

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TimeCode

      public TimeCode()
    • TimeCode

      public TimeCode​(int secs)
    • TimeCode

      public TimeCode​(int secs, int millis)
    • TimeCode

      public TimeCode​(java.lang.String s) throws java.lang.IllegalArgumentException
      Parse a time code formatted as hh:mm:ss.ff, hh:mm:ss.xxx or hh:mm:ss as a TimeCode (xxx represents fractions of a second, so .1 means a tenth of a second)
      Parameters:
      s - timecode string
      Throws:
      java.lang.IllegalArgumentException - If passed string is null or doesn't format as any of the allowed formats
  • Method Details

    • toString

      public java.lang.String toString()
      Return TimeCode formatted as h:m:ss or m:ss.xxx if there are frames too
      Overrides:
      toString in class java.lang.Object
      Returns:
    • toShortString

      public java.lang.String toShortString()
    • getSecs

      public int getSecs()
    • setSecs

      public void setSecs​(int secs)
    • getMillis

      public int getMillis()
    • setMillis

      public void setMillis​(int millis)
    • setFrames

      @Deprecated public void setFrames​(int frames)
      Deprecated.
      Use setMillis. Parameter isn't actually frames, but fractions of a second in millisecond precision
      Parameters:
      frames -
    • asMillis

      public long asMillis()
    • fromMillis

      public static TimeCode fromMillis​(long millis)
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • compareTo

      public int compareTo​(TimeCode o)
      Specified by:
      compareTo in interface java.lang.Comparable<TimeCode>
    • toJson

      public java.lang.String toJson()
      Specified by:
      toJson in interface com.github.cliftonlabs.json_simple.Jsonable
    • toJson

      public void toJson​(java.io.Writer writable) throws java.io.IOException
      Specified by:
      toJson in interface com.github.cliftonlabs.json_simple.Jsonable
      Throws:
      java.io.IOException