Borneq

File_to_string_Yaml.java

Sep 19th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1.         byte[] encoded;
  2.         try {
  3.             encoded = Files.readAllBytes(Paths.get("d:\\eclipse\\workspace\\testYAML\\Invoice.yaml"));
  4.         } catch (IOException e) {
  5.             encoded = null;
  6.             e.printStackTrace();
  7.         }
  8.         Charset encoding = StandardCharsets.UTF_8;
  9.         String content = encoding.decode(ByteBuffer.wrap(encoded)).toString();
  10.         System.out.println(content);
  11.         Yaml yaml = new Yaml();
  12.         Object o = yaml.load(content);
Advertisement
Add Comment
Please, Sign In to add comment