本文整理汇总了Java中java.io.CharArrayWriter.close方法的典型用法代码示例。如果您正苦于以下问题:Java CharArrayWriter.close方法的具体用法?Java CharArrayWriter.close怎么用?Java CharArrayWriter.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.CharArrayWriter
的用法示例。
在下文中一共展示了CharArrayWriter.close方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseScriptText
import java.io.CharArrayWriter; //导入方法依赖的package包/类
private String parseScriptText(String tx) {
CharArrayWriter cw = new CharArrayWriter();
int size = tx.length();
int i = 0;
while (i < size) {
char ch = tx.charAt(i);
if (i + 2 < size && ch == '%' && tx.charAt(i + 1) == '\\'
&& tx.charAt(i + 2) == '>') {
cw.write('%');
cw.write('>');
i += 3;
} else {
cw.write(ch);
++i;
}
}
cw.close();
return cw.toString();
}
示例2: parseScriptText
import java.io.CharArrayWriter; //导入方法依赖的package包/类
private String parseScriptText(String tx) {
CharArrayWriter cw = new CharArrayWriter();
int size = tx.length();
int i = 0;
while (i < size) {
char ch = tx.charAt(i);
if (i + 2 < size && ch == '%' && tx.charAt(i + 1) == '\\' && tx.charAt(i + 2) == '>') {
cw.write('%');
cw.write('>');
i += 3;
} else {
cw.write(ch);
++i;
}
}
cw.close();
return cw.toString();
}
示例3: verifyWriterCorrect
import java.io.CharArrayWriter; //导入方法依赖的package包/类
private boolean verifyWriterCorrect() throws Exception {
final String IDENTITY_XSLT_WITH_INDENT =
"<xsl:stylesheet version='1.0' " + // NOI18N
"xmlns:xsl='http://www.w3.org/1999/XSL/Transform' " + // NOI18N
"xmlns:xalan='http://xml.apache.org/xslt' " + // NOI18N
"exclude-result-prefixes='xalan'>" + // NOI18N
"<xsl:output method='xml' indent='yes' xalan:indent-amount='4'/>" + // NOI18N
"<xsl:template match='@*|node()'>" + // NOI18N
"<xsl:copy>" + // NOI18N
"<xsl:apply-templates select='@*|node()'/>" + // NOI18N
"</xsl:copy>" + // NOI18N
"</xsl:template>" + // NOI18N
"</xsl:stylesheet>"; // NOI18N
String data = "<root xmlns='root'/>"; // NOI18N
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(data)));
doc.getDocumentElement().appendChild(doc.createElementNS("child", "child")); // NOI18N
Transformer t = TransformerFactory.newInstance().newTransformer(
new StreamSource(new StringReader(IDENTITY_XSLT_WITH_INDENT)));
Source source = new DOMSource(doc);
CharArrayWriter output = new CharArrayWriter();
Result result = new StreamResult(output);
t.transform(source, result);
output.close();
String text = output.toString();
return text.indexOf("\"child\"") != (-1) || text.indexOf("'child'") != (-1); // NOI18N
}
示例4: getText
import java.io.CharArrayWriter; //导入方法依赖的package包/类
String getText(Mark start, Mark stop) throws JasperException {
Mark oldstart = mark();
reset(start);
CharArrayWriter caw = new CharArrayWriter();
while (!markEquals(stop)) {
caw.write(nextChar());
}
caw.close();
setCurrent(oldstart);
return caw.toString();
}
示例5: getText
import java.io.CharArrayWriter; //导入方法依赖的package包/类
String getText(Mark start, Mark stop) throws JasperException {
Mark oldstart = mark();
reset(start);
CharArrayWriter caw = new CharArrayWriter();
while (!stop.equals(mark()))
caw.write(nextChar());
caw.close();
reset(oldstart);
return caw.toString();
}
示例6: getText
import java.io.CharArrayWriter; //导入方法依赖的package包/类
String getText(Mark start, Mark stop) throws JasperException {
Mark oldstart = mark();
reset(start);
CharArrayWriter caw = new CharArrayWriter();
while (!markEquals(stop)) {
caw.write(nextChar());
}
caw.close();
setCurrent(oldstart);
return caw.toString();
}