Class DFXPCaptionConverter

java.lang.Object
org.opencastproject.caption.converters.DFXPCaptionConverter
All Implemented Interfaces:
org.opencastproject.caption.api.CaptionConverter

public class DFXPCaptionConverter extends Object implements org.opencastproject.caption.api.CaptionConverter
This is converter for DFXP, XML based caption format. DOM parser is used for both caption importing and exporting, while SAX parser is used for determining which languages are present (DFXP can contain multiple languages).
  • Constructor Details

    • DFXPCaptionConverter

      public DFXPCaptionConverter()
  • Method Details

    • importCaption

      public List<org.opencastproject.caption.api.Caption> importCaption(InputStream in, String language) throws org.opencastproject.caption.api.CaptionConverterException
      Parser used for parsing XML document is DOM parser. Language parameter will determine which language is searched for and parsed. If there is no matching language, empty collection is returned. If language parameter is null first language found is parsed.
      Specified by:
      importCaption in interface org.opencastproject.caption.api.CaptionConverter
      Throws:
      org.opencastproject.caption.api.CaptionConverterException
      See Also:
      • CaptionConverter.importCaption(java.io.InputStream, java.lang.String)
    • exportCaption

      public void exportCaption(OutputStream outputStream, List<org.opencastproject.caption.api.Caption> captions, String language) throws IOException
      DOM parser is used to parse template from which whole document is then constructed.
      Specified by:
      exportCaption in interface org.opencastproject.caption.api.CaptionConverter
      Throws:
      IOException
    • getLanguageList

      public String[] getLanguageList(InputStream input) throws org.opencastproject.caption.api.CaptionConverterException
      Uses SAX parser to quickly read the document and retrieve available languages.
      Specified by:
      getLanguageList in interface org.opencastproject.caption.api.CaptionConverter
      Throws:
      org.opencastproject.caption.api.CaptionConverterException
      See Also:
      • CaptionConverter.getLanguageList(java.io.InputStream)
    • getExtension

      public String getExtension()
      Specified by:
      getExtension in interface org.opencastproject.caption.api.CaptionConverter
      See Also:
      • CaptionConverter.getExtension()
    • getElementType

      public org.opencastproject.mediapackage.MediaPackageElement.Type getElementType()
      Specified by:
      getElementType in interface org.opencastproject.caption.api.CaptionConverter