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 Details

    • importSrt

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

      public static String exportToSrt(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(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 Time importDFXP(String timeDfxp) throws 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:
      IllegalTimeFormatException - if argument is not DFXP time format or is not supported.
    • exportToDFXP

      public static String exportToDFXP(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