本文整理汇总了Java中com.thoughtworks.xstream.core.util.QuickWriter.write方法的典型用法代码示例。如果您正苦于以下问题:Java QuickWriter.write方法的具体用法?Java QuickWriter.write怎么用?Java QuickWriter.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thoughtworks.xstream.core.util.QuickWriter
的用法示例。
在下文中一共展示了QuickWriter.write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
boolean CDATA = true;
@SuppressWarnings("rawtypes")
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (CDATA) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例2: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
@Override
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有xml节点的转换都增加CDATA标记
boolean cdata = true;
@Override
public void startNode(String name, @SuppressWarnings("rawtypes") Class clazz) {
super.startNode(name, clazz);
}
@Override
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例3: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有xml节点的转换都增加CDATA标记
boolean cdata = true;
@SuppressWarnings("unchecked")
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例4: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有 xml 节点的转换都增加 CDATA 标记
boolean cdata = true;
@SuppressWarnings("rawtypes")
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例5: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有xml节点的转换都增加CDATA标记
boolean cdata = true;
public void startNode(String name, @SuppressWarnings("rawtypes") Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
super.writeText(writer, text);
}
}
};
}
示例6: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有xml节点的转换都增加CDATA标记
boolean cdata = true;
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例7: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
@Override
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
@Override
@SuppressWarnings("rawtypes")
public void startNode(String name, Class clazz) {
//节点属性 首字母大写 排除xml item
if (!"xml".equals(name) && !"item".equals(name)) {
name = name.substring(0, 1).toUpperCase() + name.substring(1);
}
super.startNode(name, clazz);
}
@Override
protected void writeText(QuickWriter writer, String text) {
// 对所有xml节点的转换都增加CDATA标记
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
}
};
}
示例8: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有 xml 节点的转换都增加 CDATA 标记
boolean cdata = true;
@SuppressWarnings("rawtypes")
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例9: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有xml节点的转换都增加CDATA标记
boolean cdata = true;
public void startNode(String name, @SuppressWarnings("rawtypes") Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例10: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
@Override
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有xml节点的转换都增加CDATA标记
boolean cdata = true;
@SuppressWarnings("rawtypes")
@Override
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
}
@Override
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例11: buildXstream
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
private XStream buildXstream() {
return new XStream(new XppDriver() {
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
List<String> cdataFields = asList("title", "author");
boolean cdata = false;
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
cdata = cdataFields.contains(name);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
});
}
示例12: saveToFile
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
/**
* writes glossary to xml-file prepend doc-book dtd: <!DOCTYPE glossary PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
* "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
*
* @param glossaryFile
* @param glossaryItemArr
*/
private void saveToFile(VFSLeaf glossaryFile, ArrayList<GlossaryItem> glossaryItemArr) {
// cdata-tags should be used instead of strings, overwrite writer.
XStream xstream = new XStream(new XppDriver() {
@Override
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
@Override
protected void writeText(QuickWriter writer, String text) {
if (text.contains("<") || text.contains(">") || text.contains("&")) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
});
xstream.alias(XML_GLOSSARY_ITEM_NAME, GlossaryItem.class);
glossaryItemArr = removeEmptyGlossaryItems(glossaryItemArr);
XStreamHelper.writeObject(xstream, glossaryFile, glossaryItemArr);
}
示例13: createWriter
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public HierarchicalStreamWriter createWriter(Writer out) {
return new PrettyPrintWriter(out) {
// 对所有xml节点的转换都增加CDATA标记
boolean cdata = true;
@SuppressWarnings("unchecked")
public void startNode(String name, Class clazz) {
super.startNode(name, clazz);
}
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
writer.write(text);
}
}
};
}
示例14: getLoteXStream
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public static XStream getLoteXStream()
{
XStream xstream = new XStream(new XppDriver()
{
public HierarchicalStreamWriter createWriter(Writer out)
{
return new PrettyPrintWriter(out)
{
protected void writeText(QuickWriter writer, String text)
{
writer.write(text);
}
};
}
});
xstream.alias("lote", LoteXml.class);
xstream.alias("comprobante", ComprobanteXml.class);
xstream.registerConverter(new ComprobanteXmlConverter());
return xstream;
}
示例15: getRespuestaXStream
import com.thoughtworks.xstream.core.util.QuickWriter; //导入方法依赖的package包/类
public static XStream getRespuestaXStream()
{
XStream xstream = new XStream(new XppDriver()
{
public HierarchicalStreamWriter createWriter(Writer out)
{
return new PrettyPrintWriter(out)
{
protected void writeText(QuickWriter writer, String text)
{
writer.write(text);
}
};
}
});
xstream.alias("respuesta", RespuestaComprobante.class);
xstream.alias("autorizacion", Autorizacion.class);
xstream.alias("fechaAutorizacion", XMLGregorianCalendarImpl.class);
xstream.alias("mensaje", Mensaje.class);
xstream.registerConverter(new RespuestaDateConverter());
return xstream;
}