Class XLIFFProcessor
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.processor.XLIFFProcessor
-
-
Constructor Summary
Constructors Constructor Description XLIFFProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(IEventHandler handler)Adds an event handler to this processor.voidremove(int index)Removes the handler at a given position.voidremove(IEventHandler handler)Removes a given handler from this processor.voidremoveAll()Removes all handlers from this processor.voidrun()Process the document.voidrun(File inputFile)Run the processor for a given input file.voidrun(File inputFile, File outputFile)Run the processor for a given input file, and (if specified) re-write the modified document in a given output file.voidsetHandler(IEventHandler handler)Sets a single event handler to make modifications on a selection of events.voidsetInput(File inputFile)voidsetInput(InputStream inputStream)voidsetInput(String inputText)voidsetInput(URI inputURI)voidsetOutput(File outputFile)Sets the output file.voidsetOutput(Writer outputWriter)
-
-
-
Method Detail
-
setInput
public void setInput(File inputFile)
-
setInput
public void setInput(String inputText)
-
setInput
public void setInput(URI inputURI)
-
setInput
public void setInput(InputStream inputStream)
-
setOutput
public void setOutput(File outputFile)
Sets the output file.- Parameters:
outputFile- the output file (Use null to specify no output).
-
setOutput
public void setOutput(Writer outputWriter)
-
run
public void run(File inputFile, File outputFile)
Run the processor for a given input file, and (if specified) re-write the modified document in a given output file. The two file names must be different. The input and output are closed at the end of the process. This methods is an helper method that simply callssetInput(File),setOutput(File)and thenrun().- Parameters:
inputFile- document to modify.outputFile- resulting document. Use null to not produce an output file.- Throws:
InvalidParameterException- if the input and output files are the same.
-
run
public void run(File inputFile)
Run the processor for a given input file.- Parameters:
inputFile- document to process.
-
run
public void run()
Process the document. You must have set the input, output and event handler before calling this method. The input and output are closed at the end of the process.
-
setHandler
public void setHandler(IEventHandler handler)
Sets a single event handler to make modifications on a selection of events. All existing handler are removed before setting this one.- Parameters:
handler- the handler to set.
-
add
public void add(IEventHandler handler)
Adds an event handler to this processor. Existing handlers are preserved. The handlers are executed in the order they have been added.- Parameters:
handler- the handler to add.
-
removeAll
public void removeAll()
Removes all handlers from this processor.
-
remove
public void remove(IEventHandler handler)
Removes a given handler from this processor.- Parameters:
handler- the handler to remove.
-
remove
public void remove(int index)
Removes the handler at a given position.- Parameters:
index- the index of the handler to remove.- Throws:
IndexOutOfBoundsException- if the index in invalid.
-
-