本文整理了Java中org.apache.tools.ant.types.Resource.toString
方法的一些代码示例,展示了Resource.toString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.toString
方法的具体详情如下:
包路径:org.apache.tools.ant.types.Resource
类名称:Resource
方法名:toString
[英]Get the string representation of this Resource.
[中]获取此资源的字符串表示形式。
代码示例来源:origin: org.apache.ant/ant
/**
* Delegates to a comparison of names.
* @param other the object to compare to.
* @return a negative integer, zero, or a positive integer as this Resource
* is less than, equal to, or greater than the specified Resource.
* @since Ant 1.6
*/
@Override
public int compareTo(Resource other) {
if (isReference()) {
return getCheckedRef().compareTo(other);
}
return toString().compareTo(other.toString());
}
代码示例来源:origin: org.apache.ant/ant
@Override
protected synchronized void handle(Resource r) {
long size = r.getSize();
if (size == Resource.UNKNOWN_SIZE) {
log("Size unknown for " + r.toString(), Project.MSG_WARN);
} else {
accum += size;
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Return this URLResource formatted as a String.
* @return a String representation of this URLResource.
*/
public synchronized String toString() {
return isReference()
? getCheckedRef().toString() : String.valueOf(getURL());
}
代码示例来源:origin: org.apache.ant/ant
+ r1.toString() + " and " + r2.toString(), ioe);
代码示例来源:origin: org.apache.ant/ant
@Override
protected void handle(Resource r) {
getPs().print(r.toString());
getPs().print(" : ");
//when writing to the log, we'll see what's happening:
long size = r.getSize();
if (size == Resource.UNKNOWN_SIZE) {
getPs().println("unknown");
} else {
getPs().println(size);
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Return true if this Resource is selected.
* @param r the Resource to check.
* @return whether the Resource was selected.
*/
public boolean isSelected(Resource r) {
String n = r.getName();
if (matches(n)) {
return true;
}
String s = r.toString();
return !s.equals(n) && matches(s);
}
代码示例来源:origin: org.apache.ant/ant
/**
* {@inheritDoc}
*/
@Override
public String toString() {
if (isReferenceOrProxy()) {
return getReferencedOrProxied().toString();
}
return getValue();
}
代码示例来源:origin: org.apache.ant/ant
@Override
public String toString() {
if (isReference()) {
return getCheckedRef().toString();
}
return getName();
}
代码示例来源:origin: org.apache.ant/ant
private void runTransaction(PrintStream out)
throws IOException, SQLException {
if (!tSqlCommand.isEmpty()) {
log("Executing commands", Project.MSG_INFO);
runStatements(new StringReader(tSqlCommand), out);
}
if (tSrcResource != null) {
log("Executing resource: " + tSrcResource.toString(),
Project.MSG_INFO);
Charset charset = encoding == null ? Charset.defaultCharset()
: Charset.forName(encoding);
try (Reader reader = new InputStreamReader(
tSrcResource.getInputStream(), charset)) {
runStatements(reader, out);
}
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Get the string representation of this Resource.
* @return this Resource formatted as a String.
* @since Ant 1.7
*/
@Override
public String toString() {
if (isReference()) {
return getCheckedRef().toString();
}
String n = getName();
return n == null ? "(anonymous)" : n;
}
代码示例来源:origin: org.testng/testng
/**
* Returns the list of files corresponding to the resource collection
*
* @param resources - A list of {@link ResourceCollection}
* @return the list of files corresponding to the resource collection
* @throws BuildException
*/
private List<String> getFiles(List<ResourceCollection> resources) throws BuildException {
List<String> files= Lists.newArrayList();
for (ResourceCollection rc : resources) {
for (Resource o : rc) {
if (o instanceof FileResource) {
FileResource fr = ((FileResource) o);
if (fr.isDirectory()) {
throw new BuildException("Directory based FileResources are not supported.");
}
if (! fr.isExists()) {
log("'" + fr.toLongString() + "' does not exist", Project.MSG_VERBOSE);
}
files.add(fr.getFile().getAbsolutePath());
} else {
log("Unsupported Resource type: " + o.toString(), Project.MSG_VERBOSE);
}
}
}
return files;
}
代码示例来源:origin: org.apache.ant/ant
/**
* Get a long String representation of this Resource.
* This typically should be the value of <code>toString()</code>
* prefixed by a type description.
* @return this Resource formatted as a long String.
* @since Ant 1.7
*/
public final String toLongString() {
return isReference() ? getCheckedRef().toLongString()
: getDataTypeName() + " \"" + toString() + '"';
}
代码示例来源:origin: org.apache.ant/ant
/**
* validate, then hand off to the subclass
* @throws BuildException on error
*/
@Override
public void execute() throws BuildException {
validate();
Resource s = getSrcResource();
if (!s.isExists()) {
log("Nothing to do: " + s.toString()
+ " doesn't exist.");
} else if (zipFile.lastModified() < s.getLastModified()) {
log("Building: " + zipFile.getAbsolutePath());
pack();
} else {
log("Nothing to do: " + zipFile.getAbsolutePath()
+ " is up to date.");
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Format this Resource as a String.
* @return String representation of this Resource.
*/
@Override
public String toString() {
return isReference() ? getCheckedRef().toString()
: getArchive().toString() + ':' + getName();
}
代码示例来源:origin: cbeust/testng
/**
* Returns the list of files corresponding to the resource collection
*
* @param resources - A list of {@link ResourceCollection}
* @return the list of files corresponding to the resource collection
* @throws BuildException
*/
private List<String> getFiles(List<ResourceCollection> resources) throws BuildException {
List<String> files = Lists.newArrayList();
for (ResourceCollection rc : resources) {
for (Resource o : rc) {
if (o instanceof FileResource) {
FileResource fr = ((FileResource) o);
if (fr.isDirectory()) {
throw new BuildException("Directory based FileResources are not supported.");
}
if (!fr.isExists()) {
log("'" + fr.toLongString() + "' does not exist", Project.MSG_VERBOSE);
}
files.add(fr.getFile().getAbsolutePath());
} else {
log("Unsupported Resource type: " + o.toString(), Project.MSG_VERBOSE);
}
}
}
return files;
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
/**
* Load the specified Saxon configuration file.
*
* @param saxonConfigFile the path to the Saxon configuration file to be loaded
*/
public void setSaxonConfigFile(Resource saxonConfigFile) {
try {
userArgs.setSaxonConfig(saxonConfigFile.getInputStream(), saxonConfigFile.toString());
} catch (Exception e) {
handleError(e);
}
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
/**
* Specify a particular configuration file to be loaded.
*
* @param configFile the path to a particular configuration file to be loaded
*/
public void setConfigFile(Resource configFile) {
try {
userArgs.setConfig(configFile.getInputStream(), configFile.toString());
} catch (Exception e) {
handleError(e);
}
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
/**
* Set the pipeline. optional, nested <pipeline> will be used if not set.
*
* @param pipeline pipeline location
*/
public void setPipeline(Resource pipeline) {
try {
userArgs.setPipeline(pipeline.getInputStream(), pipeline.toString());
this.pipelineResource = pipeline;
} catch (Exception e) {
handleError(e);
}
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
/**
* Load the specified Saxon configuration file.
*
* @param saxonConfigFile the path to the Saxon configuration file to be loaded
*/
public void setSaxonConfigFile(Resource saxonConfigFile) {
try {
userArgs.setSaxonConfig(saxonConfigFile.getInputStream(), saxonConfigFile.toString());
} catch (Exception e) {
handleError(e);
}
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
/**
* Specify a particular configuration file to be loaded.
*
* @param configFile the path to a particular configuration file to be loaded
*/
public void setConfigFile(Resource configFile) {
try {
userArgs.setConfig(configFile.getInputStream(), configFile.toString());
} catch (Exception e) {
handleError(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!