org.apache.poi.xwpf.converter.core.openxmlformats
Class ZipArchive

java.lang.Object
  extended by org.apache.poi.xwpf.converter.core.openxmlformats.AbstractOpenXMLFormatsPartProvider
      extended by org.apache.poi.xwpf.converter.core.openxmlformats.ZipArchive
All Implemented Interfaces:
IOpenXMLFormatsPartProvider

public class ZipArchive
extends AbstractOpenXMLFormatsPartProvider

ZipArchive is used to load zipped XML document archive (docx, odt...) ZipArchive cache each entry zip to transform content stream with IXDocPreprocessor and ITemplateEngine.


Constructor Summary
ZipArchive()
           
ZipArchive(boolean trackLastModified)
           
 
Method Summary
 ZipArchive createCopy()
          Create a copy of the ZipArchive.
 void dispose()
           
 InputStream getEntryInputStream(String entryName)
          Returns an InputStream from the cache entries of the given entry.
 Set<String> getEntryNames()
          Returns the entry names of the XML document archive by using cache entries.
 Set<String> getEntryNames(String wildcard)
           
 OutputStream getEntryOutputStream(String entryName)
          Returns an OutputStream from the cache entries for writing the content of the given entry.
 long getLastModifiedEntry(String entryName)
           
 boolean hasEntry(String entryName)
          Returns true if ZipArchive contains an entry with the given name.
static ZipArchive readZip(InputStream sourceStream)
          Read zip from input stream and returns an instance of ZipArchive which cache each entry from the zip into a Map.
static void setEntry(ZipArchive archive, String entryName, InputStream input)
          Set the given input stream in the given entry of the document archive.
static void writeEntry(ZipArchive archive, String entryName, OutputStream outputStream)
          Write the given entry from the document archive in the given output stream.
static void writeZip(ZipArchive archive, OutputStream outputStream)
          Write XML document archive in the given output stream.
 
Methods inherited from class org.apache.poi.xwpf.converter.core.openxmlformats.AbstractOpenXMLFormatsPartProvider
getDocument, getFontsDocument, getFtrDocumentByPartId, getHdrDocumentByPartId, getInputStreamByRelId, getSettings, getStyle, getThemeDocuments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipArchive

public ZipArchive()

ZipArchive

public ZipArchive(boolean trackLastModified)
Method Detail

getEntryNames

public Set<String> getEntryNames()
Returns the entry names of the XML document archive by using cache entries.

Returns:

getEntryNames

public Set<String> getEntryNames(String wildcard)

getEntryInputStream

public InputStream getEntryInputStream(String entryName)
Returns an InputStream from the cache entries of the given entry.

Specified by:
getEntryInputStream in class AbstractOpenXMLFormatsPartProvider
Parameters:
entryName -
Returns:

getEntryOutputStream

public OutputStream getEntryOutputStream(String entryName)
Returns an OutputStream from the cache entries for writing the content of the given entry.

Parameters:
entryName -
Returns:
an OutputStream

createCopy

public ZipArchive createCopy()
Create a copy of the ZipArchive.

Returns:

hasEntry

public boolean hasEntry(String entryName)
Returns true if ZipArchive contains an entry with the given name.

Parameters:
entryName -
Returns:

readZip

public static ZipArchive readZip(InputStream sourceStream)
                          throws IOException
Read zip from input stream and returns an instance of ZipArchive which cache each entry from the zip into a Map.

Parameters:
sourceStream - stream of odt, docx file.
Returns:
Throws:
IOException

setEntry

public static void setEntry(ZipArchive 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(ZipArchive 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

public static void writeZip(ZipArchive archive,
                            OutputStream outputStream)
                     throws IOException
Write XML document archive in the given output stream.

Parameters:
archive -
outputStream -
Throws:
IOException

getLastModifiedEntry

public long getLastModifiedEntry(String entryName)

dispose

public void dispose()


Copyright © 2013. All rights reserved.