Class ZipResource
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.tools.ant.types.Resource
org.apache.tools.ant.types.resources.ArchiveResource
org.apache.tools.ant.types.resources.ZipResource
- All Implemented Interfaces:
- Cloneable,- Comparable<Resource>,- Iterable<Resource>,- ResourceCollection
A Resource representation of an entry in a zipfile.
- Since:
- Ant 1.7
- 
Field SummaryFields inherited from class org.apache.tools.ant.types.ResourceMAGIC, UNKNOWN_DATETIME, UNKNOWN_SIZEFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor.ZipResource(File z, String enc, ZipEntry e) Construct a ZipResource representing the specified entry in the specified zipfile.
- 
Method SummaryModifier and TypeMethodDescriptionvoidSets the archive that holds this as a single element Resource collection.protected voidfetches information from the named entry inside the archive.Get the encoding to use with the zipfile.Retrieves extra fields.Return an InputStream for reading the contents of this Resource.intThe compression method that has been used.Get an OutputStream for the Resource.protected ZipResourcegetRef()Perform the check for circular references and return the referenced Resource.static InputStreamgetZipEntryStream(ZipFile zipFile, String zipEntry) Return an InputStream for reading the contents of a ZipEntry with autoclose.Get the zipfile that holds this ZipResource.voidsetEncoding(String enc) Set the encoding to use with the zipfile.voidOverrides the super version.voidsetZipfile(File z) Set the zipfile that holds this ZipResource.Methods inherited from class org.apache.tools.ant.types.resources.ArchiveResourcecheckEntry, compareTo, dieOnCircularReference, equals, getArchive, getLastModified, getMode, getSize, hashCode, isDirectory, isExists, setArchive, setMode, toStringMethods inherited from class org.apache.tools.ant.types.Resourceas, asOptional, clone, getMagicNumber, getName, isFilesystemOnly, iterator, setDirectory, setExists, setLastModified, setName, setSize, size, toLongStringMethods inherited from class org.apache.tools.ant.types.DataTypecheckAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributesMethods inherited from class org.apache.tools.ant.ProjectComponentgetDescription, getLocation, getProject, log, log, setDescription, setLocation, setProjectMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface org.apache.tools.ant.types.ResourceCollectionisEmpty, stream
- 
Constructor Details- 
ZipResourcepublic ZipResource()Default constructor.
- 
ZipResourceConstruct 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.
 
 
- 
- 
Method Details- 
setZipfileSet the zipfile that holds this ZipResource.- Parameters:
- z- the zipfile as a File.
 
- 
getZipfileGet the zipfile that holds this ZipResource.- Returns:
- the zipfile as a File.
 
- 
addConfiguredSets the archive that holds this as a single element Resource collection.- Overrides:
- addConfiguredin class- ArchiveResource
- Parameters:
- a- the archive as a single element Resource collection.
 
- 
setEncodingSet the encoding to use with the zipfile.- Parameters:
- enc- the String encoding.
 
- 
getEncodingGet the encoding to use with the zipfile.- Returns:
- String encoding.
 
- 
setRefidOverrides the super version.- Overrides:
- setRefidin class- ArchiveResource
- Parameters:
- r- the Reference to set.
 
- 
getInputStreamReturn an InputStream for reading the contents of this Resource.- Overrides:
- getInputStreamin class- Resource
- Returns:
- an InputStream object.
- Throws:
- IOException- if the zip file cannot be opened, or the entry cannot be read.
 
- 
getOutputStreamGet an OutputStream for the Resource.- Overrides:
- getOutputStreamin class- Resource
- Returns:
- an OutputStream to which content can be written.
- Throws:
- IOException- if unable to provide the content of this Resource as a stream.
- UnsupportedOperationException- if OutputStreams are not supported for this Resource type.
 
- 
getExtraFieldsRetrieves extra fields.- Returns:
- an array of the extra fields
- Since:
- Ant 1.8.0
 
- 
getMethodpublic int getMethod()The compression method that has been used.- Returns:
- int
- Since:
- Ant 1.8.0
 
- 
getZipEntryStreamReturn an InputStream for reading the contents of a ZipEntry with autoclose.- Parameters:
- zipFile- a org.apache.tools.zip.ZipFile
- zipEntry- String a name of a zip entry
- Returns:
- an InputStream object
- Throws:
- IOException- if the entry cannot be read
 
- 
fetchEntryprotected void fetchEntry()fetches information from the named entry inside the archive.- Specified by:
- fetchEntryin class- ArchiveResource
 
- 
getRefDescription copied from class:ResourcePerform the check for circular references and return the referenced Resource.- Overrides:
- getRefin class- ArchiveResource
- Returns:
- Resource.
 
 
-