Package fr.opensagres.xdocreport.core.io
Class XDocArchive
java.lang.Object
fr.opensagres.xdocreport.core.io.XDocArchive
- All Implemented Interfaces:
IEntryInputStreamProvider,IEntryOutputStreamProvider,IEntryReaderProvider,IEntryWriterProvider
public class XDocArchive
extends Object
implements IEntryInputStreamProvider, IEntryReaderProvider, IEntryWriterProvider, IEntryOutputStreamProvider
XDocArchive is used to load zipped XML document archive (docx, odt...) XDocArchive cache each entry
zip to transform content stream with IXDocPreprocessor and ITemplateEngine.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a copy of theXDocArchive.voiddispose()getEntryInfo(String entryName) getEntryInputStream(String entryName) Returns anInputStreamfrom the cache entries of the given entry.Returns the entry names of the XML document archive by using cache entries.getEntryNames(String wildcard) getEntryOutputStream(String entryName) Returns anOutputStreamfrom the cache entries for writing the content of the given entry.getEntryReader(String entryName) Returns aReader(UTF-8) from the cache entries of the given entry.getEntryWriter(String entryName) Returns anWriterfrom the cache entries for writing the content of the given entry.static InputStreamgetInputStream(XDocArchive archive) Returns the input stream of the givenXDocArchive.longgetLastModifiedEntry(String entryName) booleanReturns true ifXDocArchivecontains an entry with the given name.static XDocArchivereadZip(InputStream sourceStream) Read zip from input stream and returns an instance ofXDocArchivewhich cache each entry from the zip into a Map.static voidsetEntry(XDocArchive archive, String entryName, InputStream input) Set the given input stream in the given entry of the document archive.static voidwriteEntry(XDocArchive archive, String entryName, OutputStream outputStream) Write the given entry from the document archive in the given output stream.static voidwriteZip(XDocArchive archive, OutputStream outputStream) Write XML document archive in the given output stream.
-
Constructor Details
-
XDocArchive
public XDocArchive() -
XDocArchive
public XDocArchive(boolean trackLastModified)
-
-
Method Details
-
getEntryNames
Returns the entry names of the XML document archive by using cache entries.- Returns:
-
getEntryNames
-
getEntryInputStream
Returns anInputStreamfrom the cache entries of the given entry.- Specified by:
getEntryInputStreamin interfaceIEntryInputStreamProvider- Parameters:
entryName-- Returns:
-
getEntryReader
Returns aReader(UTF-8) from the cache entries of the given entry.- Specified by:
getEntryReaderin interfaceIEntryReaderProvider- Parameters:
entryName-- Returns:
-
getEntryOutputStream
Returns anOutputStreamfrom the cache entries for writing the content of the given entry.- Specified by:
getEntryOutputStreamin interfaceIEntryOutputStreamProvider- Parameters:
entryName-- Returns:
- an
OutputStream
-
getEntryWriter
Returns anWriterfrom the cache entries for writing the content of the given entry.- Specified by:
getEntryWriterin interfaceIEntryWriterProvider- Parameters:
entryName-- Returns:
- a
Writer
-
createCopy
Create a copy of theXDocArchive.- Returns:
-
hasEntry
Returns true ifXDocArchivecontains an entry with the given name.- Parameters:
entryName-- Returns:
-
readZip
Read zip from input stream and returns an instance ofXDocArchivewhich cache each entry from the zip into a Map.- Parameters:
sourceStream- stream of odt, docx file.- Returns:
- Throws:
IOException
-
setEntry
public static void setEntry(XDocArchive archive, String entryName, InputStream input) throws IOException Set the given input stream in the given entry of the document archive.- Parameters:
archive-inputStream-- Throws:
IOException
-
writeEntry
public static void writeEntry(XDocArchive archive, String entryName, OutputStream outputStream) throws IOException Write the given entry from the document archive in the given output stream.- Parameters:
archive-outputStream-- Throws:
IOException
-
writeZip
Write XML document archive in the given output stream.- Parameters:
archive-outputStream-- Throws:
IOException
-
getInputStream
Returns the input stream of the givenXDocArchive.- Parameters:
archive-- Returns:
- the input stream of the given
XDocArchive. - Throws:
IOException
-
getLastModifiedEntry
-
getEntryInfo
-
dispose
public void dispose()
-