org.apache.commons.compress
Class ArchiverFactory

java.lang.Object
  extended by org.apache.commons.compress.ArchiverFactory

public class ArchiverFactory
extends Object

Provides implementations for all ArchiverFactory methods.


Method Summary
static Archive getInstance(File file)
          Returns an archiver, filled with an existing archive.
static Archive getInstance(String archiverName)
          Returns an empty Archive, if an archiver could be found for this factory.
static void registerArchiver(Class clazz)
          Registers a new archiver in the factory.
static void registerArchiver(String className)
          Registers a new archiver in the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerArchiver

public static void registerArchiver(String className)
                             throws ClassNotFoundException,
                                    ArchiveException
Registers a new archiver in the factory. The archiver must implement the archiver interface.

Parameters:
className - full qualified archiver implementation
Throws:
ClassNotFoundException - if the new archiver class could not be found
ArchiveException - if the new archiver does not implement the archiver interface

registerArchiver

public static void registerArchiver(Class clazz)
                             throws ArchiveException
Registers a new archiver in the factory. The archiver must implement the archiver interface and must be an concrete implementation

Parameters:
clazz - full qualified archiver implementation
Throws:
ArchiveException - if the new archiver does not implement the archiver interface

getInstance

public static Archive getInstance(String archiverName)
                           throws ArchiveException
Returns an empty Archive, if an archiver could be found for this factory. If two Archive-implementations with the same name are registered, the first matching archiver will be instanciated.

Returns:
the archiver, or null, if no matching archiver could be found
Throws:
ArchiveException - if the archiver could not be created

getInstance

public static Archive getInstance(File file)
                           throws ArchiveException
Returns an archiver, filled with an existing archive. Uses the byte header to identify the archiver. If no corresponding archiver could be found, a filename extension check will be done.

Parameters:
file - an existing archive
Returns:
an archiver, filled with the archive
Throws:
ArchiveException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.