Class TimeUtil

java.lang.Object
org.opencastproject.caption.util.TimeUtil

public final class TimeUtil extends Object
Auxiliary class that contains methods for converting from and to specific time formats.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    exportToDFXP(org.opencastproject.caption.api.Time time)
    Exports Time instance to the DFXP time format representation.
    static String
    exportToSrt(org.opencastproject.caption.api.Time time)
    Exports Time instance to the SubRip time format representation.
    static String
    exportToVtt(org.opencastproject.caption.api.Time time)
    Exports Time instance to the WebVTT time format representation.
    static org.opencastproject.caption.api.Time
    importDFXP(String timeDfxp)
    Parse String representation of DFXP time format.
    static org.opencastproject.caption.api.Time
    importSrt(String timeSrt)
    Parse String representation of SubRip time format.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • importSrt

      public static org.opencastproject.caption.api.Time importSrt(String timeSrt) throws org.opencastproject.caption.api.IllegalTimeFormatException
      Parse String representation of SubRip time format.
      Parameters:
      timeSrt - SubRip time format
      Returns:
      parsed Time instance
      Throws:
      org.opencastproject.caption.api.IllegalTimeFormatException - if argument is not SubRip time format
    • exportToSrt

      public static String exportToSrt(org.opencastproject.caption.api.Time time)
      Exports Time instance to the SubRip time format representation.
      Parameters:
      time - Time instance to be exported
      Returns:
      time exported to SubRip time format
    • exportToVtt

      public static String exportToVtt(org.opencastproject.caption.api.Time time)
      Exports Time instance to the WebVTT time format representation.
      Parameters:
      time - Time instance to be exported
      Returns:
      time exported to WebVTT time format
    • importDFXP

      public static org.opencastproject.caption.api.Time importDFXP(String timeDfxp) throws org.opencastproject.caption.api.IllegalTimeFormatException
      Parse String representation of DFXP time format. It does not support parsing of metrics (for example: 34.567s).
      Parameters:
      timeDfxp - DFXP time format
      Returns:
      parsed Time instance
      Throws:
      org.opencastproject.caption.api.IllegalTimeFormatException - if argument is not DFXP time format or is not supported.
    • exportToDFXP

      public static String exportToDFXP(org.opencastproject.caption.api.Time time)
      Exports Time instance to the DFXP time format representation. Specifically time format used is 0:00:00.000
      Parameters:
      time - Time instance to be exported
      Returns:
      time exported to DFXP time format