提交 2f99ea26 编写于 作者: K kohsuke

added a method to read it into a string.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3908 71c3de6d-444a-0410-be80-ed276b4c234a
上级 8c4f9f60
......@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Writer;
import java.io.StringWriter;
import java.util.logging.Logger;
/**
......@@ -163,6 +164,15 @@ public final class XmlFile {
return new InputStreamReader(new FileInputStream(file),sniffEncoding());
}
/**
* Returns the XML file read as a string.
*/
public String asString() throws IOException {
StringWriter w = new StringWriter();
writeRawTo(w);
return w.toString();
}
/**
* Writes the raw XML to the given {@link Writer}.
* Writer will not be closed by the implementation.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册