久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='EpJBN'></bdo><ul id='EpJBN'></ul>

<i id='EpJBN'><tr id='EpJBN'><dt id='EpJBN'><q id='EpJBN'><span id='EpJBN'><b id='EpJBN'><form id='EpJBN'><ins id='EpJBN'></ins><ul id='EpJBN'></ul><sub id='EpJBN'></sub></form><legend id='EpJBN'></legend><bdo id='EpJBN'><pre id='EpJBN'><center id='EpJBN'></center></pre></bdo></b><th id='EpJBN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='EpJBN'><tfoot id='EpJBN'></tfoot><dl id='EpJBN'><fieldset id='EpJBN'></fieldset></dl></div>

  • <tfoot id='EpJBN'></tfoot>

      <legend id='EpJBN'><style id='EpJBN'><dir id='EpJBN'><q id='EpJBN'></q></dir></style></legend>
    1. <small id='EpJBN'></small><noframes id='EpJBN'>

        使用 SnakeYaml 轉儲帶引號的值

        Dumping values with quotes with SnakeYaml(使用 SnakeYaml 轉儲帶引號的值)

            • <bdo id='nGslD'></bdo><ul id='nGslD'></ul>
                  <tfoot id='nGslD'></tfoot>

                  <small id='nGslD'></small><noframes id='nGslD'>

                  <i id='nGslD'><tr id='nGslD'><dt id='nGslD'><q id='nGslD'><span id='nGslD'><b id='nGslD'><form id='nGslD'><ins id='nGslD'></ins><ul id='nGslD'></ul><sub id='nGslD'></sub></form><legend id='nGslD'></legend><bdo id='nGslD'><pre id='nGslD'><center id='nGslD'></center></pre></bdo></b><th id='nGslD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='nGslD'><tfoot id='nGslD'></tfoot><dl id='nGslD'><fieldset id='nGslD'></fieldset></dl></div>

                  <legend id='nGslD'><style id='nGslD'><dir id='nGslD'><q id='nGslD'></q></dir></style></legend>
                    <tbody id='nGslD'></tbody>
                  本文介紹了使用 SnakeYaml 轉儲帶引號的值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有一個簡單的yml文件test.yml如下

                  Having a simple yml file test.yml as follows

                  color: 'red'
                  

                  我按如下方式加載和轉儲文件

                  I load and dump the file as follows

                          final DumperOptions yamlOptions = new DumperOptions();
                          yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
                  
                          Yaml yaml = new Yaml(yamlOptions);
                  
                  
                          Object result = yaml.load(new FileInputStream(new File("test.yml")));
                  
                          System.out.println(yaml.dump(result));
                  

                  我希望得到

                  color: 'red'
                  

                  但是,在轉儲期間,序列化程序會忽略引號并打印

                  However, the during the dump, the serializer leaves out the quotes and prints

                  color: red
                  

                  如何讓序列化程序也打印原始引號?

                  How can I make the serializer to print the original quotes too?

                  推薦答案

                  如何讓序列化程序也打印原始引號?

                  How can I make the serializer to print the original quotes too?

                  不使用高級 API.引用規范:

                  Not with the high-level API. Quoting the spec:

                  標量樣式是一種表示細節,不得用于傳達內容信息,除非為了標簽解析的目的而區分普通標量.

                  The scalar style is a presentation detail and must not be used to convey content information, with the exception that plain scalars are distinguished for the purpose of tag resolution.

                  高級 API 實現了整個 YAML 加載過程,按照規范的要求,只為您提供 YAML 文件的內容,而沒有任何有關表示細節的信息.

                  The high-level API implements the whole YAML loading process, giving you only the content of the YAML file, without any information about presentation details, as required by the spec.

                  話雖如此,您可以使用保留演示詳細信息的低級 API:

                  That being said, you can use the low level API which preserves presentation details:

                  final Yaml yaml = new Yaml();
                  final Iterator<Event> events = yaml.parse(new StreamReader(new UnicodeReader(
                          new FileInputStream(new File("test.yml"))).iterator();
                  
                  final DumperOptions yamlOptions = new DumperOptions();
                  final Emitter emitter = new Emitter(new PrintWriter(System.out), yamlOptions);
                  while (events.hasNext()) emitter.emit(events.next());
                  

                  但是,請注意,即使這樣也不會保留您輸入的每個演示細節(例如,不會保留縮進和注釋).SnakeYaml 不是往返的,因此無法保留準確的輸入布局.

                  However, be aware that even this will not preserve every presentation detail of your input (e.g. indentation and comments will not be preserved). SnakeYaml is not round-tripping and therefore unable to preserve the exact input layout.

                  這篇關于使用 SnakeYaml 轉儲帶引號的值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                    <bdo id='zGbau'></bdo><ul id='zGbau'></ul>

                        1. <legend id='zGbau'><style id='zGbau'><dir id='zGbau'><q id='zGbau'></q></dir></style></legend>

                          <small id='zGbau'></small><noframes id='zGbau'>

                            <i id='zGbau'><tr id='zGbau'><dt id='zGbau'><q id='zGbau'><span id='zGbau'><b id='zGbau'><form id='zGbau'><ins id='zGbau'></ins><ul id='zGbau'></ul><sub id='zGbau'></sub></form><legend id='zGbau'></legend><bdo id='zGbau'><pre id='zGbau'><center id='zGbau'></center></pre></bdo></b><th id='zGbau'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zGbau'><tfoot id='zGbau'></tfoot><dl id='zGbau'><fieldset id='zGbau'></fieldset></dl></div>
                            <tfoot id='zGbau'></tfoot>
                              <tbody id='zGbau'></tbody>
                            主站蜘蛛池模板: 一区二区三区四区不卡 | www性色| 成人国产一区二区三区精品麻豆 | 日韩激情在线 | 国产精品视频久久久久 | 亚洲成人网在线 | 亚洲成人综合社区 | 欧美精品在线一区二区三区 | www.狠狠干 | 激情网站在线 | 自拍偷拍亚洲视频 | 综合精品久久久 | 男女爱爱福利视频 | 国产在线一区二区三区 | 午夜www| 亚洲国产免费 | 特级丰满少妇一级aaaa爱毛片 | 日韩欧美国产精品 | 国产精品视频免费观看 | 亚洲成人播放器 | 国产在线精品一区二区 | 51ⅴ精品国产91久久久久久 | 午夜在线| 影音先锋中文字幕在线观看 | 日日操夜夜干 | 国产亚洲一区二区三区在线 | av黄色在线| 免费黄色特级片 | 久久久视频在线 | 色综网 | 国产精品福利网站 | 天天操天天插 | 免费性视频 | www.天天干.com | 在线观看免费av网 | 美女毛片免费看 | 国产一区二区三区四区三区四 | 久久久成人网 | 国产有码 | 欧美一级欧美三级在线观看 | 中文字幕成人av |