Package net.sf.okapi.common.filterwriter
Class ZipFilterWriter
- java.lang.Object
-
- net.sf.okapi.common.filterwriter.ZipFilterWriter
-
- All Implemented Interfaces:
AutoCloseable,IFilterWriter
public class ZipFilterWriter extends Object implements IFilterWriter
Implements theIFilterWriterinterface for filters that handle formats made of a ZIP package with embedded extractable documents, such as IDML or OpenOffice.org files (ODT, ODS, ODP, etc.)
-
-
Constructor Summary
Constructors Constructor Description ZipFilterWriter(EncoderManager encoderManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the current process.voidclose()Closes the output.protected StartDocumentconvertToStartDocument(StartSubDocument res)protected IFilterWritercreateSubDocumentFilterWriter(StartSubDocument res)protected ISkeletonWritercreateSubDocumentSkeletonWriter(StartSubDocument res)EncoderManagergetEncoderManager()Gets the current encoder manager for this writer.LocaleIdgetLocale()StringgetName()Gets the name of this writer.IParametersgetParameters()Gets the current parameters for this writer.ISkeletonWritergetSkeletonWriter()Gets the skeleton writer associated with this writer.IFilterWritergetSubDocWriter()EventhandleEvent(Event event)Handles the filter events.protected voidprocessDocumentPart(Event event)protected voidprocessEndSubDocument(Ending res)protected voidprocessStartDocument(StartDocument res)protected voidprocessStartSubDocument(StartSubDocument res)voidsetOptions(LocaleId locale, String defaultEncoding)Sets the options for this writer.voidsetOutput(OutputStream output)Sets the output through its output stream.voidsetOutput(String path)Sets the output through the path of the output file.voidsetParameters(IParameters params)Sets new parameters for this writer.voidsetSubDocWriter(IFilterWriter subDocWriter)
-
-
-
Constructor Detail
-
ZipFilterWriter
public ZipFilterWriter(EncoderManager encoderManager)
-
-
Method Detail
-
cancel
public void cancel()
Description copied from interface:IFilterWriterCancels the current process.- Specified by:
cancelin interfaceIFilterWriter
-
close
public void close()
Description copied from interface:IFilterWriterCloses the output. Developers must make sure this method is safe to call even if there is nothing to close.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIFilterWriter
-
getName
public String getName()
Description copied from interface:IFilterWriterGets the name of this writer.- Specified by:
getNamein interfaceIFilterWriter- Returns:
- The name of the writer.
-
getEncoderManager
public EncoderManager getEncoderManager()
Description copied from interface:IFilterWriterGets the current encoder manager for this writer. Some special implementation of IFilterWriter may not use an encoder manager (for example writers that do not use skeleton).- Specified by:
getEncoderManagerin interfaceIFilterWriter- Returns:
- the current encoder manager for this writer, or null if none exists for this writer.
-
getSkeletonWriter
public ISkeletonWriter getSkeletonWriter()
Description copied from interface:IFilterWriterGets the skeleton writer associated with this writer. Some implementation of IFilterWriter may not use a skeleton writer.- Specified by:
getSkeletonWriterin interfaceIFilterWriter- Returns:
- the skeleton writer associated with this writer or null if none is associated.
-
getParameters
public IParameters getParameters()
Description copied from interface:IFilterWriterGets the current parameters for this writer.- Specified by:
getParametersin interfaceIFilterWriter- Returns:
- The current parameters for this writer.
-
handleEvent
public Event handleEvent(Event event)
Description copied from interface:IFilterWriterHandles the filter events.- Specified by:
handleEventin interfaceIFilterWriter- Parameters:
event- The event to process.- Returns:
- The event that was processed.
-
setOptions
public void setOptions(LocaleId locale, String defaultEncoding)
Description copied from interface:IFilterWriterSets the options for this writer.- Specified by:
setOptionsin interfaceIFilterWriter- Parameters:
locale- the output locale.defaultEncoding- Name of the character set encoding for the output.
-
setOutput
public void setOutput(String path)
Description copied from interface:IFilterWriterSets the output through the path of the output file.- Specified by:
setOutputin interfaceIFilterWriter- Parameters:
path- Full path of the output file.
-
setOutput
public void setOutput(OutputStream output)
Description copied from interface:IFilterWriterSets the output through its output stream.- Specified by:
setOutputin interfaceIFilterWriter- Parameters:
output- Output stream to use for the output.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IFilterWriterSets new parameters for this writer.- Specified by:
setParametersin interfaceIFilterWriter- Parameters:
params- The new parameters to use.
-
processStartDocument
protected void processStartDocument(StartDocument res)
-
processDocumentPart
protected void processDocumentPart(Event event)
-
createSubDocumentSkeletonWriter
protected ISkeletonWriter createSubDocumentSkeletonWriter(StartSubDocument res)
-
createSubDocumentFilterWriter
protected IFilterWriter createSubDocumentFilterWriter(StartSubDocument res)
-
convertToStartDocument
protected StartDocument convertToStartDocument(StartSubDocument res)
-
processStartSubDocument
protected void processStartSubDocument(StartSubDocument res)
-
processEndSubDocument
protected void processEndSubDocument(Ending res)
-
getSubDocWriter
public IFilterWriter getSubDocWriter()
-
setSubDocWriter
public void setSubDocWriter(IFilterWriter subDocWriter)
-
getLocale
public final LocaleId getLocale()
-
-