ShrinkWrap Aggregator and Build Parent 1.0.0-cr-1

org.jboss.shrinkwrap.impl.base.exporter
Class AbstractStreamExporterImpl

java.lang.Object
  extended by org.jboss.shrinkwrap.impl.base.AssignableBase<Archive<?>>
      extended by org.jboss.shrinkwrap.impl.base.exporter.AbstractStreamExporterImpl
All Implemented Interfaces:
Assignable, StreamExporter
Direct Known Subclasses:
TarExporterImpl, TarGzExporterImpl, ZipExporterImpl

public abstract class AbstractStreamExporterImpl
extends AssignableBase<Archive<?>>
implements StreamExporter

Base support for I/O Stream-based exporters

Author:
ALR

Constructor Summary
AbstractStreamExporterImpl(Archive<?> archive)
           
 
Method Summary
 void exportTo(File target)
          Exports provided archive as in an implementation-specific format, written to the specified File target.
 void exportTo(File target, boolean overwrite)
          Exports provided archive an implementation-specific format, written to the specified File target.
 void exportTo(OutputStream target)
          Exports provided archive in an implementation-specific format, written to the specified OutputStream target.
protected  OutputStream getOutputStreamToFile(File target, boolean overwrite)
          Obtains an OuputStream to the provided File.
 
Methods inherited from class org.jboss.shrinkwrap.impl.base.AssignableBase
as, getArchive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.shrinkwrap.api.exporter.StreamExporter
exportAsInputStream
 
Methods inherited from interface org.jboss.shrinkwrap.api.Assignable
as
 

Constructor Detail

AbstractStreamExporterImpl

public AbstractStreamExporterImpl(Archive<?> archive)
Method Detail

getOutputStreamToFile

protected final OutputStream getOutputStreamToFile(File target,
                                                   boolean overwrite)
                                            throws FileExistsException,
                                                   IllegalArgumentException
Obtains an OuputStream to the provided File.

Parameters:
target -
overwrite - Whether we may overwrite an existing file
Returns:
Throws:
FileExistsException - If the specified file exists and the overwrite flag is false
IllegalArgumentException - If the file target is not specified

exportTo

public void exportTo(OutputStream target)
              throws ArchiveExportException,
                     IllegalArgumentException
Exports provided archive in an implementation-specific format, written to the specified OutputStream target. The specified target will not be closed or flushed; this is the responsibility of the caller (who supplied the OutputStream in the first place).

Specified by:
exportTo in interface StreamExporter
Throws:
ArchiveExportException
IllegalArgumentException - If the target is not specified or is closed
See Also:
StreamExporter.exportTo(java.io.OutputStream)

exportTo

public final void exportTo(File target,
                           boolean overwrite)
                    throws ArchiveExportException,
                           FileExistsException,
                           IllegalArgumentException
Exports provided archive an implementation-specific format, written to the specified File target. If the target both exists and the "overwrite" flag is true, this call will allow the existing file to be overwritten, else the invocation will fail with IllegalArgumentException

Specified by:
exportTo in interface StreamExporter
Throws:
ArchiveExportException - if the export process fails
FileExistsException - If the target both already exists and the overwrite flag is false
IllegalArgumentException - If the target is not specified or is a directory
See Also:
StreamExporter.exportTo(java.io.File, boolean)

exportTo

public final void exportTo(File target)
                    throws ArchiveExportException,
                           FileExistsException,
                           IllegalArgumentException
Exports provided archive as in an implementation-specific format, written to the specified File target. If the target exists this call will fail with IllegalArgumentException

Specified by:
exportTo in interface StreamExporter
Throws:
ArchiveExportException - if the export process fails
FileExistsException - If the target already exists
IllegalArgumentException - If the target is not specified
See Also:
StreamExporter.exportTo(java.io.File)

ShrinkWrap Aggregator and Build Parent 1.0.0-cr-1

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