本文整理汇总了Java中com.sun.org.apache.xml.internal.serializer.SerializationHandler.startDocument方法的典型用法代码示例。如果您正苦于以下问题:Java SerializationHandler.startDocument方法的具体用法?Java SerializationHandler.startDocument怎么用?Java SerializationHandler.startDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xml.internal.serializer.SerializationHandler
的用法示例。
在下文中一共展示了SerializationHandler.startDocument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openOutputHandler
import com.sun.org.apache.xml.internal.serializer.SerializationHandler; //导入方法依赖的package包/类
/************************************************************************
* Multiple output document extension.
* See compiler/TransletOutput for actual implementation.
************************************************************************/
public SerializationHandler openOutputHandler(String filename, boolean append)
throws TransletException
{
try {
final TransletOutputHandlerFactory factory
= TransletOutputHandlerFactory.newInstance();
String dirStr = new File(filename).getParent();
if ((null != dirStr) && (dirStr.length() > 0)) {
File dir = new File(dirStr);
dir.mkdirs();
}
factory.setEncoding(_encoding);
factory.setOutputMethod(_method);
factory.setOutputStream(new BufferedOutputStream(new FileOutputStream(filename, append)));
factory.setOutputType(TransletOutputHandlerFactory.STREAM);
final SerializationHandler handler
= factory.getSerializationHandler();
transferOutputSettings(handler);
handler.startDocument();
return handler;
}
catch (Exception e) {
throw new TransletException(e);
}
}
示例2: openOutputHandler
import com.sun.org.apache.xml.internal.serializer.SerializationHandler; //导入方法依赖的package包/类
/************************************************************************
* Multiple output document extension.
* See compiler/TransletOutput for actual implementation.
************************************************************************/
public SerializationHandler openOutputHandler(String filename, boolean append)
throws TransletException
{
try {
final TransletOutputHandlerFactory factory
= TransletOutputHandlerFactory.newInstance();
String dirStr = new File(filename).getParent();
if ((null != dirStr) && (dirStr.length() > 0)) {
File dir = new File(dirStr);
dir.mkdirs();
}
output = new FileOutputStream(filename, append);
factory.setEncoding(_encoding);
factory.setOutputMethod(_method);
factory.setOutputStream(new BufferedOutputStream(output));
factory.setOutputType(TransletOutputHandlerFactory.STREAM);
final SerializationHandler handler
= factory.getSerializationHandler();
transferOutputSettings(handler);
handler.startDocument();
return handler;
}
catch (Exception e) {
throw new TransletException(e);
}
}