org.apache.ant.compress.resources
Class ZipResource

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.types.DataType
          extended by org.apache.tools.ant.types.Resource
              extended by org.apache.tools.ant.types.resources.ArchiveResource
                  extended by org.apache.ant.compress.resources.CommonsCompressArchiveResource
                      extended by org.apache.ant.compress.resources.ZipResource
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, org.apache.tools.ant.types.ResourceCollection

public final class ZipResource
extends CommonsCompressArchiveResource

A Resource representation of an entry in a zipfile.


Field Summary
 
Fields inherited from class org.apache.tools.ant.types.Resource
MAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZE
 
Fields inherited from class org.apache.tools.ant.types.DataType
checked, ref
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
ZipResource()
          Default constructor.
ZipResource(java.io.File z, java.lang.String enc, org.apache.commons.compress.archivers.zip.ZipArchiveEntry e)
          Construct a ZipResource representing the specified entry in the specified zipfile.
ZipResource(org.apache.tools.ant.types.Resource z, java.lang.String enc, org.apache.commons.compress.archivers.zip.ZipArchiveEntry e)
          Construct a ZipResource representing the specified entry in the specified zip archive.
 
Method Summary
protected  void fetchEntry()
          fetches information from the named entry inside the archive.
 org.apache.commons.compress.archivers.zip.ZipExtraField[] getExtraFields()
          Retrieves extra fields.
 java.io.InputStream getInputStream()
          Return an InputStream for reading the contents of this Resource.
 int getMethod()
          The compression method that has been used.
 java.io.File getZipfile()
          Get the zipfile that holds this ZipResource.
protected  void setEntry(org.apache.commons.compress.archivers.ArchiveEntry e)
           
 void setZipfile(java.io.File z)
          Set the zipfile that holds this ZipResource.
 void setZipResource(org.apache.tools.ant.types.Resource z)
          Set the zipfile that holds this ZipResource.
 
Methods inherited from class org.apache.ant.compress.resources.CommonsCompressArchiveResource
getEncoding, getGid, getOutputStream, getUid, setEncoding, setRefid
 
Methods inherited from class org.apache.tools.ant.types.resources.ArchiveResource
addConfigured, checkEntry, compareTo, dieOnCircularReference, equals, getArchive, getLastModified, getMode, getSize, hashCode, isDirectory, isExists, setArchive, setMode, toString
 
Methods inherited from class org.apache.tools.ant.types.Resource
as, clone, getMagicNumber, getName, isFilesystemOnly, iterator, setDirectory, setExists, setLastModified, setName, setSize, size, toLongString
 
Methods inherited from class org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZipResource

public ZipResource()
Default constructor.


ZipResource

public ZipResource(java.io.File z,
                   java.lang.String enc,
                   org.apache.commons.compress.archivers.zip.ZipArchiveEntry e)
Construct a ZipResource representing the specified entry in the specified zipfile.

Parameters:
z - the zipfile as File.
enc - the encoding used for filenames.
e - the ZipEntry.

ZipResource

public ZipResource(org.apache.tools.ant.types.Resource z,
                   java.lang.String enc,
                   org.apache.commons.compress.archivers.zip.ZipArchiveEntry e)
Construct a ZipResource representing the specified entry in the specified zip archive.

Parameters:
z - the zipfile as File.
enc - the encoding used for filenames.
e - the ZipEntry.
Method Detail

setZipfile

public void setZipfile(java.io.File z)
Set the zipfile that holds this ZipResource.

Parameters:
z - the zipfile as a File.

setZipResource

public void setZipResource(org.apache.tools.ant.types.Resource z)
Set the zipfile that holds this ZipResource.

Parameters:
z - the zipfile as a Resource.

getZipfile

public java.io.File getZipfile()
Get the zipfile that holds this ZipResource.

Returns:
the zipfile as a File or null if it is not a file.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Return an InputStream for reading the contents of this Resource.

Overrides:
getInputStream in class CommonsCompressArchiveResource
Returns:
an InputStream object.
Throws:
java.io.IOException - if the zip file cannot be opened, or the entry cannot be read.

getExtraFields

public org.apache.commons.compress.archivers.zip.ZipExtraField[] getExtraFields()
Retrieves extra fields.

Returns:
an array of the extra fields

getMethod

public int getMethod()
The compression method that has been used.


fetchEntry

protected void fetchEntry()
fetches information from the named entry inside the archive.

Overrides:
fetchEntry in class CommonsCompressArchiveResource

setEntry

protected void setEntry(org.apache.commons.compress.archivers.ArchiveEntry e)
Overrides:
setEntry in class CommonsCompressArchiveResource