Methods Summary |
---|
protected synchronized java.lang.String | getContent()Get the content of this StringResource.
if (isReference()) {
return ((StringResource) getCheckedRef()).getContent();
}
String value = getValue();
if (value == null) {
return value;
}
return getProject() == null
? value : getProject().replaceProperties(value);
|
public synchronized java.lang.String | getEncoding()Get the encoding used by this StringResource.
return encoding;
|
public synchronized java.io.InputStream | getInputStream()Get an InputStream for the Resource.
if (isReference()) {
return ((Resource) getCheckedRef()).getInputStream();
}
//I can't get my head around this; is encoding treatment needed here?
return
//new oata.util.ReaderInputStream(new InputStreamReader(
new ByteArrayInputStream(getContent().getBytes());
//, encoding), encoding);
|
public synchronized java.lang.String | getName()Synchronize access.
return super.getName();
|
public synchronized java.io.OutputStream | getOutputStream()Get an OutputStream for the Resource.
if (isReference()) {
return ((Resource) getCheckedRef()).getOutputStream();
}
if (getValue() != null) {
throw new ImmutableResourceException();
}
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
return new FilterOutputStream(baos) {
public void close() throws IOException {
super.close();
StringResource.this.setValue(encoding == null
? baos.toString() : baos.toString(encoding));
}
};
|
public synchronized long | getSize()Get the size of this Resource.
return isReference()
? ((Resource) getCheckedRef()).getSize()
: (long) getContent().length();
|
public synchronized java.lang.String | getValue()Get the value of this StringResource.
return getName();
|
public synchronized int | hashCode()Get the hash code for this Resource.
if (isReference()) {
return getCheckedRef().hashCode();
}
return super.hashCode() * STRING_MAGIC;
|
public synchronized void | setEncoding(java.lang.String s)Set the encoding to be used for this StringResource.
encoding = s;
|
public synchronized void | setName(java.lang.String s)Enforce String immutability.
if (getName() != null) {
throw new BuildException(new ImmutableResourceException());
}
super.setName(s);
|
public void | setRefid(org.apache.tools.ant.types.Reference r)Overrides the super version.
if (encoding != null) {
throw tooManyAttributes();
}
super.setRefid(r);
|
public synchronized void | setValue(java.lang.String s)The value attribute is a semantically superior alias for the name attribute.
setName(s);
|
public java.lang.String | toString()Get the string.
if (isReference()) {
return getCheckedRef().toString();
}
return String.valueOf(getContent());
|