Methods Summary |
---|
public synchronized void | add(org.apache.tools.ant.util.Tokenizer tokenizer)Add the nested Tokenizer to this Tokens ResourceCollection.
A LineTokenizer will be used by default.
if (isReference()) {
throw noChildrenAllowed();
}
if (this.tokenizer != null) {
throw new BuildException("Only one nested tokenizer allowed.");
}
this.tokenizer = tokenizer;
|
protected synchronized void | dieOnCircularReference(java.util.Stack stk, org.apache.tools.ant.Project p)Overrides the BaseResourceCollectionContainer version
to check the nested Tokenizer.
if (isChecked()) {
return;
}
if (isReference()) {
super.dieOnCircularReference(stk, p);
} else {
if (tokenizer instanceof DataType) {
stk.push(tokenizer);
invokeCircularReferenceCheck((DataType) tokenizer, stk, p);
}
setChecked(true);
}
|
protected synchronized java.util.Collection | getCollection()Sort the contained elements.
ResourceCollection rc = getResourceCollection();
if (rc.size() == 0) {
return Collections.EMPTY_SET;
}
if (tokenizer == null) {
tokenizer = new LineTokenizer();
}
ConcatResourceInputStream cat = new ConcatResourceInputStream(rc);
cat.setManagingComponent(this);
InputStreamReader rdr = null;
if (encoding == null) {
rdr = new InputStreamReader(cat);
} else {
try {
rdr = new InputStreamReader(cat, encoding);
} catch (UnsupportedEncodingException e) {
throw new BuildException(e);
}
}
ArrayList result = new ArrayList();
try {
for (String s = tokenizer.getToken(rdr); s != null; s = tokenizer.getToken(rdr)) {
result.add(new StringResource(s));
}
} catch (IOException e) {
throw new BuildException("Error reading tokens", e);
}
return result;
|
public synchronized void | setEncoding(java.lang.String encoding)Set the encoding used to create the tokens.
this.encoding = encoding;
|