Package org.apache.felix.inventory
Interface ZipAttachmentProvider
-
@ConsumerType public interface ZipAttachmentProvider
This is an optional extension of theInventoryPrinter
. If a inventory printer implements this interface, the printer can add additional attachments to the output of the configuration ZIP.A service implementing this method must register itself as a
InventoryPrinter
but not as aZipAttachmentProvider
service. When writing output to a ZIP file, this method is called if theInventoryPrinter
service implements this interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAttachments(java.util.zip.ZipOutputStream zos, java.lang.String namePrefix)
Add attachments to the zip output stream.
-
-
-
Method Detail
-
addAttachments
void addAttachments(java.util.zip.ZipOutputStream zos, java.lang.String namePrefix) throws java.io.IOException
Add attachments to the zip output stream. The attachment provider can add as many attachments in any format as it wants. However it should use the namePrefix to create unique names / paths inside the zip.The general pattern is to do for each entry to be added:
- Create ZipEntry with a name composed of
namePrefix
and a name unique to the attachement provider, e.g.namePrefix + "att1.txt"
. - Add the ZipEntry to the ZIP file
zos
. - Write the contents of the entry; for example copying a filesystem
file to the ZIP file
zos
. - Close the ZipEntry.
- Parameters:
zos
- The zip output stream.namePrefix
- Name prefix to use for zip entries. Ends with a slash.- Throws:
java.io.IOException
- If an error occurrs writing the ZIP entry. This may also be caused by reading some file system file to be added to the ZIP file.
- Create ZipEntry with a name composed of
-
-