本文整理匯總了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);
}