org.apache.commons.compress
Class PackableObject

java.lang.Object
  extended by org.apache.commons.compress.PackableObject
Direct Known Subclasses:
AbstractArchive, AbstractCompressor

public abstract class PackableObject
extends Object

Abstract super object for Compressor and Archiver classes.


Field Summary
protected static int CHOOSE_EXTENSION
           
protected static int CHOOSE_NAME
           
 
Constructor Summary
PackableObject()
           
 
Method Summary
abstract  String getDefaultFileExtension()
          Returns the default FileExtension for this archive, for example "zip", "tar"...
abstract  byte[] getHeader()
          Header byte array for this archive.
abstract  String getName()
          Returns the ArchiveName for this archive.
static PackableObject identifyByHeader(File file, List packables)
          Compares a file to a list of packables and identifies an object by header.
protected  boolean isPackableWith(Object value, int choose)
          String Chooser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHOOSE_EXTENSION

protected static final int CHOOSE_EXTENSION
See Also:
Constant Field Values

CHOOSE_NAME

protected static final int CHOOSE_NAME
See Also:
Constant Field Values
Constructor Detail

PackableObject

public PackableObject()
Method Detail

getHeader

public abstract byte[] getHeader()
Header byte array for this archive.


getDefaultFileExtension

public abstract String getDefaultFileExtension()
Returns the default FileExtension for this archive, for example "zip", "tar"...


getName

public abstract String getName()
Returns the ArchiveName for this archive.


isPackableWith

protected boolean isPackableWith(Object value,
                                 int choose)
String Chooser.

Parameters:
value -
choose -
Returns:

identifyByHeader

public static PackableObject identifyByHeader(File file,
                                              List packables)
                                       throws IOException
Compares a file to a list of packables and identifies an object by header. If no matching header is found, it identifies the file by file extension. If identification was not successfull, null is returned

Parameters:
file - the file to identify
packables - a list of packables
Returns:
a matching packable object, or null
Throws:
IOException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.