Package net.sf.okapi.filters.ttml
Class TTMLFilter
- java.lang.Object
-
- net.sf.okapi.common.filters.AbstractFilter
-
- net.sf.okapi.filters.subtitles.SubtitleFilter
-
- net.sf.okapi.filters.ttml.TTMLFilter
-
- All Implemented Interfaces:
AutoCloseable
,Iterator<Event>
,IFilter
public class TTMLFilter extends SubtitleFilter
TTML Filter
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_TIME_BEGIN
static String
ATTR_TIME_END
static String
FILTER_MIME
static String
FILTER_NAME
-
Fields inherited from class net.sf.okapi.filters.subtitles.SubtitleFilter
DEFAULT_TIME_FORMAT, eventBuilder, formatter, hasUtf8Bom, hasUtf8Encoding, LOGGER, maxChar, maxLine, params, terminalPattern
-
Fields inherited from interface net.sf.okapi.common.filters.IFilter
SUB_FILTER
-
-
Constructor Summary
Constructors Constructor Description TTMLFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addString(String string)
void
close()
Closes the input document.ISkeletonWriter
createSkeletonWriter()
Default case.TTMLParameters
getParameters()
Gets the current parameters for this filter.protected String
getTerminalRegex()
boolean
hasNext()
Indicates if there is an event to process.Event
next()
Gets the next event available.void
open(RawDocument input, boolean generateSkeleton)
Opens the input document described in a give RawDocument object, and optionally creates skeleton information.void
setParameters(IParameters params)
Sets new parameters for this filter.-
Methods inherited from class net.sf.okapi.filters.subtitles.SubtitleFilter
addCaptionAnnotation, addToDocumentPart, addToTextUnit, endFilter, endsWithPunctuation, getDateTimeFormatter, getMaxChar, getMaxLine, isCJK, isInsideTextRun, isUtf8Bom, isUtf8Encoding, makeCaptionAnnotation, needToAppendWhitespace, needToPrependWhitespace, open
-
Methods inherited from class net.sf.okapi.common.filters.AbstractFilter
addConfiguration, addConfiguration, addConfiguration, addConfigurations, cancel, createEndFilterEvent, createFilterWriter, createStartFilterEvent, findConfiguration, getConfiguration, getConfigurations, getDisplayName, getDocumentId, getDocumentName, getEncoderManager, getEncoding, getFilterConfigurationMapper, getMimeType, getName, getNewlineType, getParameters, getParametersClassName, getParentId, getSrcLoc, getTrgLoc, isCanceled, isGenerateSkeleton, isMultilingual, removeConfiguration, setDisplayName, setDocumentName, setEncoding, setFilterConfigurationMapper, setGenerateSkeleton, setMimeType, setMultilingual, setName, setNewlineType, setOptions, setParentId, setSrcLoc, setTrgLoc
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Field Detail
-
FILTER_NAME
public static final String FILTER_NAME
- See Also:
- Constant Field Values
-
FILTER_MIME
public static final String FILTER_MIME
- See Also:
- Constant Field Values
-
ATTR_TIME_BEGIN
public static final String ATTR_TIME_BEGIN
- See Also:
- Constant Field Values
-
ATTR_TIME_END
public static final String ATTR_TIME_END
- See Also:
- Constant Field Values
-
-
Method Detail
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IFilter
Sets new parameters for this filter.- Specified by:
setParameters
in interfaceIFilter
- Overrides:
setParameters
in classSubtitleFilter
- Parameters:
params
- The new parameters to use.
-
getParameters
public TTMLParameters getParameters()
Description copied from interface:IFilter
Gets the current parameters for this filter.- Specified by:
getParameters
in interfaceIFilter
- Overrides:
getParameters
in classSubtitleFilter
- Returns:
- The current parameters for this filter, or
DefaultParameters
if this filter has no parameters.
-
createSkeletonWriter
public ISkeletonWriter createSkeletonWriter()
Description copied from class:AbstractFilter
Default case. Override if needed.- Specified by:
createSkeletonWriter
in interfaceIFilter
- Overrides:
createSkeletonWriter
in classAbstractFilter
- Returns:
- new instance of
GenericSkeletonWriter
-
close
public void close()
Description copied from interface:IFilter
Closes the input document. Developers should call this method from within their code before sending the last event: This can allow writer objects to overwrite the input file when they receive the last event. This method must also be safe to call even if the input document is not opened.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceIFilter
- Overrides:
close
in classAbstractFilter
-
open
public void open(RawDocument input, boolean generateSkeleton)
Description copied from interface:IFilter
Opens the input document described in a give RawDocument object, and optionally creates skeleton information.- Specified by:
open
in interfaceIFilter
- Overrides:
open
in classSubtitleFilter
- Parameters:
input
- The RawDocument object to use to open the document.generateSkeleton
- true to generate the skeleton data, false otherwise.
-
hasNext
public boolean hasNext()
Description copied from interface:IFilter
Indicates if there is an event to process.Implementer Note: The caller must be able to call this method several times without changing state.
-
next
public Event next()
Description copied from interface:IFilter
Gets the next event available. Calling this method can be done only once on each event.- Returns:
- The next event available or null if there are no events.
-
addString
protected void addString(String string)
- Overrides:
addString
in classSubtitleFilter
-
getTerminalRegex
protected String getTerminalRegex()
- Specified by:
getTerminalRegex
in classSubtitleFilter
-
-