本文整理汇总了Java中org.yaml.snakeyaml.DumperOptions.setAllowUnicode方法的典型用法代码示例。如果您正苦于以下问题:Java DumperOptions.setAllowUnicode方法的具体用法?Java DumperOptions.setAllowUnicode怎么用?Java DumperOptions.setAllowUnicode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.yaml.snakeyaml.DumperOptions
的用法示例。
在下文中一共展示了DumperOptions.setAllowUnicode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dumpMap
import org.yaml.snakeyaml.DumperOptions; //导入方法依赖的package包/类
protected final String dumpMap(LinkedHashMap<Object, Object> toStore, String header) {
DumperOptions dumperOptions = new DumperOptions();
toStore = cleanMap(toStore);
dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK);
dumperOptions.setAllowUnicode(true);
Yaml rl = new Yaml(dumperOptions);
StringWriter stringWriter = new StringWriter();
BufferedWriter ws = new BufferedWriter(stringWriter);
try {
ws.write(header);
ws.newLine();
rl.dump(toStore, ws);
return stringWriter.toString().replaceAll(NOVALUE, "");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: setupDumper
import org.yaml.snakeyaml.DumperOptions; //导入方法依赖的package包/类
private static void setupDumper() {
options = new DumperOptions();
representer = new Representer();
options.setIndent(2);
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setAllowUnicode(Charset.defaultCharset().name().contains("UTF"));
representer.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
}
示例3: dumpMap
import org.yaml.snakeyaml.DumperOptions; //导入方法依赖的package包/类
protected String dumpMap(LinkedHashMap<Object, Object> toStore) {
DumperOptions dumperOptions = new DumperOptions();
toStore = cleanMap(toStore);
dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK);
dumperOptions.setAllowUnicode(true);
Yaml rl = new Yaml(dumperOptions);
StringWriter stringWriter = new StringWriter();
BufferedWriter ws = new BufferedWriter(stringWriter);
try {
rl.dump(toStore, ws);
return stringWriter.toString().replaceAll(NOVALUE, "");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例4: getDumperOptions
import org.yaml.snakeyaml.DumperOptions; //导入方法依赖的package包/类
protected static DumperOptions getDumperOptions() {
DumperOptions options = new DumperOptions();
options.setAllowUnicode(true);
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setIndent(4);
return options;
}
示例5: newYaml
import org.yaml.snakeyaml.DumperOptions; //导入方法依赖的package包/类
private static Yaml newYaml(boolean useSingleQuotes) {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setAllowUnicode(true);
if (useSingleQuotes) {
options.setDefaultScalarStyle(DumperOptions.ScalarStyle.SINGLE_QUOTED);
}
return new Yaml(options);
}
示例6: createYaml
import org.yaml.snakeyaml.DumperOptions; //导入方法依赖的package包/类
private Yaml createYaml() {
DumperOptions options = new DumperOptions();
options.setAllowUnicode(false);
options.setDefaultScalarStyle(ScalarStyle.DOUBLE_QUOTED);
return new Yaml(options);
}
示例7: getYaml
import org.yaml.snakeyaml.DumperOptions; //导入方法依赖的package包/类
private static Yaml getYaml() {
DumperOptions options = new DumperOptions();
options.setAllowUnicode(true);
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
return new Yaml(options);
}