ShrinkWrap Aggregator and Build Parent 1.0.0-cr-1

org.jboss.shrinkwrap.impl.base.exporter.zip
Class JdkZipExporterDelegate

java.lang.Object
  extended by org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate<InputStream>
      extended by org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase<ZipOutputStream>
          extended by org.jboss.shrinkwrap.impl.base.exporter.zip.JdkZipExporterDelegate

public class JdkZipExporterDelegate
extends StreamExporterDelegateBase<ZipOutputStream>

JDK-based implementation of a ZIP exporter. Cannot handle archives with no content (as there'd be no ZipEntrys to write to the ZipOutputStream

Version:
$Revision: $
Author:
ALR

Field Summary
 
Fields inherited from class org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase
latch, outputStream
 
Constructor Summary
JdkZipExporterDelegate(Archive<?> archive)
          Creates a new exporter delegate for exporting archives as ZIP
 
Method Summary
protected  void closeEntry(ZipOutputStream outputStream)
          Closes the current entry context for the specified OutputStream
protected  ZipOutputStream createOutputStream(OutputStream out)
          Creates the real OutputStream to which we'll write, wrapping the provided target.
protected  Callable<Void> getExportTask(Callable<Void> wrappedTask)
          Returns the task used to run the export operation in another Thread.
protected  void putNextExtry(ZipOutputStream outputStream, String context)
          Writes the next entry (demarcates a new file/folder is to be written)
 
Methods inherited from class org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase
doExport, getExportedPaths, getResult, processNode
 
Methods inherited from class org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate
export, getArchive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdkZipExporterDelegate

public JdkZipExporterDelegate(Archive<?> archive)
                       throws IllegalArgumentException
Creates a new exporter delegate for exporting archives as ZIP

Throws:
IllegalArgumentException - If the archive has no Assets; JDK ZIP handling cannot support writing out to a ZipOutputStream with no ZipEntrys.
Method Detail

closeEntry

protected final void closeEntry(ZipOutputStream outputStream)
                         throws IOException
Closes the current entry context for the specified OutputStream

Specified by:
closeEntry in class StreamExporterDelegateBase<ZipOutputStream>
Throws:
IOException
See Also:
StreamExporterDelegateBase.closeEntry(java.io.OutputStream)

createOutputStream

protected final ZipOutputStream createOutputStream(OutputStream out)
                                            throws IOException
Creates the real OutputStream to which we'll write, wrapping the provided target.

Specified by:
createOutputStream in class StreamExporterDelegateBase<ZipOutputStream>
Returns:
Throws:
IOException - If an error occurred in creating the stream
See Also:
StreamExporterDelegateBase.createOutputStream(java.io.OutputStream)

putNextExtry

protected final void putNextExtry(ZipOutputStream outputStream,
                                  String context)
                           throws IOException
Writes the next entry (demarcates a new file/folder is to be written)

Specified by:
putNextExtry in class StreamExporterDelegateBase<ZipOutputStream>
Throws:
IOException - If an error occurred writing the entry
See Also:
StreamExporterDelegateBase.putNextExtry(java.io.OutputStream, java.lang.String)

getExportTask

protected Callable<Void> getExportTask(Callable<Void> wrappedTask)
Returns the task used to run the export operation in another Thread. Exposed such that the specified task (which handles the export) may be wrapped in some error handling logic specific to the export process.

Specified by:
getExportTask in class StreamExporterDelegateBase<ZipOutputStream>
Parameters:
wrappedTask - The export task to be wrapped in more specific handling logic
See Also:
org.jboss.shrinkwrap.impl.base.exporter.StreamExporterDelegateBase#getExportTask()

ShrinkWrap Aggregator and Build Parent 1.0.0-cr-1

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.