Top Description Fields Constructors Methods
org.apache.tools.ant.types.resources

public abstract Class ArchiveResource

extends Resource
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.types.resources.TarResource, org.apache.tools.ant.types.resources.ZipResource
Imports
java.io.File, java.util.Stack, org.apache.tools.ant.BuildException, .Project, org.apache.tools.ant.types.Reference, .Resource, .ResourceCollection

A Resource representation of an entry inside an archive.
Since
Ant 1.7

Field Summary

Modifier and TypeField and Description
private Resource
private boolean
private int
private boolean
private static final int
Inherited from org.apache.tools.ant.types.Resource:
MAGICUNKNOWN_DATETIMEUNKNOWN_SIZE

Constructor Summary

AccessConstructor and Description
protected
ArchiveResource()

Default constructor.

protected
ArchiveResource(File
the archive as File.
a
)

Construct a ArchiveResource representing the specified entry in the specified archive.

protected
ArchiveResource(File
the archive as File.
a
,
boolean
if the entry has been specified.
withEntry
)

Construct a ArchiveResource representing the specified entry in the specified archive.

protected
ArchiveResource(Resource
the archive as Resource.
a
,
boolean
if the entry has been specified.
withEntry
)

Construct a ArchiveResource representing the specified entry in the specified archive.

Method Summary

Modifier and TypeMethod and Description
public void
addConfigured(ResourceCollection
the archive as a single element Resource collection.
a
)

Sets the archive that holds this as a single element Resource collection.

protected final synchronized void
checkEntry()

Validate settings and ensure that the represented "archive entry" has been established.

public int

Returns:

a negative integer, zero, or a positive integer as this Resource is less than, equal to, or greater than the specified Resource.
compareTo
(Resource
the other Resource against which to compare.
another
)

Overrides org.apache.tools.ant.types.Resource.compareTo.

Implements java.lang.Comparable.compareTo.

Compare this ArchiveResource to another Resource.
protected synchronized void
dieOnCircularReference(Stack<Object>
the stack of references to check.
stk
,
Project
the project to use to dereference the references.
p
)

Overrides org.apache.tools.ant.types.DataType.dieOnCircularReference.

Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).
public boolean

Returns:

true if another is a Resource representing the same entry in the same archive.
equals
(Object
the other Object to compare.
another
)

Overrides org.apache.tools.ant.types.Resource.equals.

Compare another Object to this ArchiveResource for equality.
protected abstract void
fetchEntry()

Fetch information from the named entry inside the archive.

public Resource

Returns:

the archive as a Resource.
getArchive
()

Get the archive that holds this Resource.

public long

Returns:

the last modification date.
getLastModified
()

Overrides org.apache.tools.ant.types.Resource.getLastModified.

Get the last modified date of this Resource.
public int

Returns:

integer representation of Unix permission mask.
getMode
()

Get the file or dir mode for this Resource.

protected ArchiveResource
getRef()

Overrides org.apache.tools.ant.types.Resource.getRef.

Perform the check for circular references and return the referenced Resource.
public long

Returns:

the long size of this Resource.
getSize
()

Overrides org.apache.tools.ant.types.Resource.getSize.

Get the size of this Resource.
public int

Returns:

hash code as int.
hashCode
()

Overrides org.apache.tools.ant.types.Resource.hashCode.

Get the hash code for this Resource.
public boolean

Returns:

boolean flag indicating whether the entry is a directory.
isDirectory
()

Overrides org.apache.tools.ant.types.Resource.isDirectory.

Learn whether this Resource represents a directory.
public boolean

Returns:

boolean existence flag.
isExists
()

Overrides org.apache.tools.ant.types.Resource.isExists.

Find out whether this Resource represents an existing Resource.
public void
setArchive(File
the archive as a File.
a
)

Set the archive that holds this Resource.

public void
setMode(int
integer representation of Unix permission mask.
mode
)

Sets the file or dir mode for this resource.

public void
setRefid(Reference
the Reference to set.
r
)

Overrides org.apache.tools.ant.types.Resource.setRefid.

Overrides the super version.
public String

Returns:

String representation of this Resource.
toString
()

Overrides org.apache.tools.ant.types.Resource.toString.

Format this Resource as a String.
Inherited from org.apache.tools.ant.types.Resource:
asasOptionalclonegetInputStreamgetMagicNumbergetNamegetOutputStreamisFilesystemOnlyiteratorsetDirectorysetExistssetLastModifiedsetNamesetSizesizetoLongString

Field Detail

archiveback to summary
private Resource archive
haveEntryback to summary
private boolean haveEntry
modeback to summary
private int mode
modeSetback to summary
private boolean modeSet
NULL_ARCHIVEback to summary
private static final int NULL_ARCHIVE

Constructor Detail

ArchiveResourceback to summary
protected ArchiveResource()

Default constructor.

ArchiveResourceback to summary
protected ArchiveResource(File a)

Construct a ArchiveResource representing the specified entry in the specified archive.

Parameters
a:File

the archive as File.

ArchiveResourceback to summary
protected ArchiveResource(File a, boolean withEntry)

Construct a ArchiveResource representing the specified entry in the specified archive.

Parameters
a:File

the archive as File.

withEntry:boolean

if the entry has been specified.

ArchiveResourceback to summary
protected ArchiveResource(Resource a, boolean withEntry)

Construct a ArchiveResource representing the specified entry in the specified archive.

Parameters
a:Resource

the archive as Resource.

withEntry:boolean

if the entry has been specified.

Method Detail

addConfiguredback to summary
public void addConfigured(ResourceCollection a)

Sets the archive that holds this as a single element Resource collection.

Parameters
a:ResourceCollection

the archive as a single element Resource collection.

checkEntryback to summary
protected final synchronized void checkEntry() throws BuildException

Validate settings and ensure that the represented "archive entry" has been established.

compareToback to summary
public int compareTo(Resource another)

Overrides org.apache.tools.ant.types.Resource.compareTo.

Implements java.lang.Comparable.compareTo.

Compare this ArchiveResource to another Resource.

Parameters
another:Resource

the other Resource against which to compare.

Returns:int

a negative integer, zero, or a positive integer as this Resource is less than, equal to, or greater than the specified Resource.

Annotations
@Override
dieOnCircularReferenceback to summary
protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p)

Overrides org.apache.tools.ant.types.DataType.dieOnCircularReference.

Doc from org.apache.tools.ant.types.DataType.dieOnCircularReference.

Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).

If one is included, throw a BuildException created by circularReference.

This implementation is appropriate only for a DataType that cannot hold other DataTypes as children.

The general contract of this method is that it shouldn't do anything if checked is true and set it to true on exit.

Parameters
stk:Stack<Object>

the stack of references to check.

p:Project

the project to use to dereference the references.

Annotations
@Override
equalsback to summary
public boolean equals(Object another)

Overrides org.apache.tools.ant.types.Resource.equals.

Compare another Object to this ArchiveResource for equality.

Parameters
another:Object

the other Object to compare.

Returns:boolean

true if another is a Resource representing the same entry in the same archive.

Annotations
@Override
fetchEntryback to summary
protected abstract void fetchEntry()

Fetch information from the named entry inside the archive.

getArchiveback to summary
public Resource getArchive()

Get the archive that holds this Resource.

Returns:Resource

the archive as a Resource.

getLastModifiedback to summary
public long getLastModified()

Overrides org.apache.tools.ant.types.Resource.getLastModified.

Get the last modified date of this Resource.

Returns:long

the last modification date.

Annotations
@Override
getModeback to summary
public int getMode()

Get the file or dir mode for this Resource.

Returns:int

integer representation of Unix permission mask.

getRefback to summary
protected ArchiveResource getRef()

Overrides org.apache.tools.ant.types.Resource.getRef.

Doc from org.apache.tools.ant.types.Resource.getRef.

Perform the check for circular references and return the referenced Resource.

Returns:ArchiveResource

Resource.

Annotations
@Override
getSizeback to summary
public long getSize()

Overrides org.apache.tools.ant.types.Resource.getSize.

Get the size of this Resource.

Returns:long

the long size of this Resource.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides org.apache.tools.ant.types.Resource.hashCode.

Get the hash code for this Resource.

Returns:int

hash code as int.

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Overrides org.apache.tools.ant.types.Resource.isDirectory.

Learn whether this Resource represents a directory.

Returns:boolean

boolean flag indicating whether the entry is a directory.

Annotations
@Override
isExistsback to summary
public boolean isExists()

Overrides org.apache.tools.ant.types.Resource.isExists.

Find out whether this Resource represents an existing Resource.

Returns:boolean

boolean existence flag.

Annotations
@Override
setArchiveback to summary
public void setArchive(File a)

Set the archive that holds this Resource.

Parameters
a:File

the archive as a File.

setModeback to summary
public void setMode(int mode)

Sets the file or dir mode for this resource.

Parameters
mode:int

integer representation of Unix permission mask.

setRefidback to summary
public void setRefid(Reference r)

Overrides org.apache.tools.ant.types.Resource.setRefid.

Overrides the super version.

Parameters
r:Reference

the Reference to set.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.apache.tools.ant.types.Resource.toString.

Format this Resource as a String.

Returns:String

String representation of this Resource.

Annotations
@Override