Package ca.phon.util

Class MsFormatter

java.lang.Object
ca.phon.util.MsFormatter
All Implemented Interfaces:
Formatter<Long>

public class MsFormatter extends Object implements Formatter<Long>
Format time values in miliseconds into parseable strings.
  • Constructor Details

    • MsFormatter

      public MsFormatter()
  • Method Details

    • createFormatter

      public static Format createFormatter()
      Create a new formatter object.
      Returns:
      formatter
    • msToDisplayString

      public static String msToDisplayString(long ms)
      Convert a value in miliseconds into a string.
      Parameters:
      ms -
      Returns:
      ms as a readable string
    • displayStringToMs

      public static long displayStringToMs(String msText) throws ParseException
      Parse the given string into a value in miliseconds.
      Parameters:
      msText -
      Returns:
      time in miliseconds
      Throws:
      ParseException
    • format

      public String format(Long obj)
      Description copied from interface: Formatter
      Convert the given object into a formatted String.
      Specified by:
      format in interface Formatter<Long>
      Returns:
      formatted string
    • parse

      public Long parse(String text) throws ParseException
      Description copied from interface: Formatter
      Parse the given string into a new object instance
      Specified by:
      parse in interface Formatter<Long>
      Returns:
      parsed object
      Throws:
      ParseException - if there was a problem parsing the given text