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

public Class PropertyResource

extends Resource
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, .OutputStream, org.apache.tools.ant.Project, .PropertyHelper, org.apache.tools.ant.types.Resource, org.apache.tools.ant.util.PropertyOutputStream

Exposes an Ant property as a Resource.
Since
Ant 1.7

Field Summary

Modifier and TypeField and Description
private static final int
PROPERTY_MAGIC

Magic number

private static final InputStream
Inherited from org.apache.tools.ant.types.Resource:
MAGICUNKNOWN_DATETIMEUNKNOWN_SIZE

Constructor Summary

AccessConstructor and Description
public
PropertyResource()

Default constructor.

public
PropertyResource(Project
the project to use.
p
,
String
the String name of this PropertyResource (Ant property name/key).
n
)

Construct a new PropertyResource with the specified name.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if equal to o
equals
(Object
object to compare
o
)

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

Override to implement equality with equivalent Resources, since we are capable of proxying them.
public InputStream

Returns:

an InputStream containing this Resource's content.
getInputStream
()

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

Get an InputStream for the Resource.
public Object

Returns:

the Object value of the specified Property.
getObjectValue
()

Get the Object value of this PropertyResource.

public OutputStream

Returns:

an OutputStream to which content can be written.
getOutputStream
()

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

Get an OutputStream for the Resource.
protected PropertyResource
getRef()

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

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

Returns:

Resource
getReferencedOrProxied
()

Get the referenced or proxied Resource, if applicable.

public long

Returns:

the size, as a long, 0 if the Resource does not exist (for compatibility with java.io.File), or UNKNOWN_SIZE if not known.
getSize
()

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

Get the size of this Resource.
public String

Returns:

the value of the specified Property.
getValue
()

Get the value of this PropertyResource.

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:

true if the Property is set, false otherwise.
isExists
()

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

Find out whether this Resource exists.
protected boolean

Returns:

boolean
isReferenceOrProxy
()

Learn whether this PropertyResource either refers to another Resource or proxies another Resource due to its object property value being said Resource.

public String
toString()

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

Get the string representation of this Resource.
Inherited from org.apache.tools.ant.types.Resource:
asasOptionalclonecompareTogetLastModifiedgetMagicNumbergetNameisDirectoryisFilesystemOnlyiteratorsetDirectorysetExistssetLastModifiedsetNamesetRefidsetSizesizetoLongString

Field Detail

PROPERTY_MAGICback to summary
private static final int PROPERTY_MAGIC

Magic number

UNSETback to summary
private static final InputStream UNSET

Constructor Detail

PropertyResourceback to summary
public PropertyResource()

Default constructor.

PropertyResourceback to summary
public PropertyResource(Project p, String n)

Construct a new PropertyResource with the specified name.

Parameters
p:Project

the project to use.

n:String

the String name of this PropertyResource (Ant property name/key).

Method Detail

equalsback to summary
public boolean equals(Object o)

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

Override to implement equality with equivalent Resources, since we are capable of proxying them.

Parameters
o:Object

object to compare

Returns:boolean

true if equal to o

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

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

Get an InputStream for the Resource.

Returns:InputStream

an InputStream containing this Resource's content.

Annotations
@Override
Exceptions
IOException:
if unable to provide the content of this Resource as a stream.
UnsupportedOperationException:
if InputStreams are not supported for this Resource type.
getObjectValueback to summary
public Object getObjectValue()

Get the Object value of this PropertyResource.

Returns:Object

the Object value of the specified Property.

Since
Ant 1.8.1
getOutputStreamback to summary
public OutputStream getOutputStream() throws IOException

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

Get an OutputStream for the Resource.

Returns:OutputStream

an OutputStream to which content can be written.

Annotations
@Override
Exceptions
IOException:
if unable to provide the content of this Resource as a stream.
UnsupportedOperationException:
if OutputStreams are not supported for this Resource type.
getRefback to summary
protected PropertyResource 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:PropertyResource

Resource.

Annotations
@Override
getReferencedOrProxiedback to summary
protected Resource getReferencedOrProxied()

Get the referenced or proxied Resource, if applicable.

Returns:Resource

Resource

Exceptions
IllegalStateException:
if this PropertyResource neither proxies nor references another Resource.
getSizeback to summary
public long getSize()

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

Get the size of this Resource.

Returns:long

the size, as a long, 0 if the Resource does not exist (for compatibility with java.io.File), or UNKNOWN_SIZE if not known.

Annotations
@Override
getValueback to summary
public String getValue()

Get the value of this PropertyResource.

Returns:String

the value of the specified Property.

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
isExistsback to summary
public boolean isExists()

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

Find out whether this Resource exists.

Returns:boolean

true if the Property is set, false otherwise.

Annotations
@Override
isReferenceOrProxyback to summary
protected boolean isReferenceOrProxy()

Learn whether this PropertyResource either refers to another Resource or proxies another Resource due to its object property value being said Resource.

Returns:boolean

boolean

toStringback to summary
public String toString()

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

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

Get the string representation of this Resource.

Returns:String

this Resource formatted as a String.

Annotations
@Override