Class DFXPCaptionConverter
java.lang.Object
org.opencastproject.caption.converters.DFXPCaptionConverter
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexportCaption(OutputStream outputStream, List<Caption> captions, String language) Exports caption collection.Get type of specific caption element (Catalog, Attachment).Get extension of specific caption format.String[]getLanguageList(InputStream input) Reads captions and return information about language if such information is available.importCaption(InputStream in, String language) Imports captions toList.
-
Constructor Details
-
DFXPCaptionConverter
public DFXPCaptionConverter()
-
-
Method Details
-
importCaption
public List<Caption> importCaption(InputStream in, String language) throws CaptionConverterException Imports captions toList. If caption format is capable of containing more than one language, language parameter is used to define which captions are parsed. 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 isnullfirst language found is parsed.- Specified by:
importCaptionin interfaceCaptionConverter- Parameters:
in- stream from where captions are readlanguage- (optional) captions' language- Returns:
ListList of captions- Throws:
CaptionConverterException- if parser encounters an exception- See Also:
-
exportCaption
public void exportCaption(OutputStream outputStream, List<Caption> captions, String language) throws IOException Exports caption collection. Language parameter is used to set language of the captions for those caption format that are capable of storing information about language. DOM parser is used to parse template from which whole document is then constructed.- Specified by:
exportCaptionin interfaceCaptionConverter- Parameters:
outputStream- stream to which captions are writtencaptions- collection to be exportedlanguage- (optional) captions' language- Throws:
IOException- if exception occurs writing to output stream
-
getLanguageList
Reads captions and return information about language if such information is available. Returns empty list otherwise. Uses SAX parser to quickly read the document and retrieve available languages.- Specified by:
getLanguageListin interfaceCaptionConverter- Parameters:
input- stream from where captions are read- Returns:
- Array containing languages in captions
- Throws:
CaptionConverterException- if parser encounters exception- See Also:
-
getExtension
Get extension of specific caption format.- Specified by:
getExtensionin interfaceCaptionConverter- Returns:
- caption format extension
- See Also:
-
getElementType
Description copied from interface:CaptionConverterGet type of specific caption element (Catalog, Attachment).- Specified by:
getElementTypein interfaceCaptionConverter- Returns:
- type
-