package com.yamlTest;
import java.io.UnsupportedEncodingException;
public class foo {
private byte[] fooBytes;
public String getFooBytes() {
return getStringFromUTF8Bytes(fooBytes);
}
public void setFooBytes(String string) {
fooBytes = getUTF8Bytes(string);
}
private static final byte[] getUTF8Bytes(String string) {
if (string == null)
return null;
try {
return string.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
return null;
}
}
private static final String getStringFromUTF8Bytes(byte[] bytes) {
if (bytes == null)
return null;
try {
return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
return null;
}
}
}
public static void main(String[] args) throws FileNotFoundException, YamlException {
// TODO Auto-generated method stub
File f = new File("data/foo.yml");
YamlReader reader = new YamlReader(new FileReader(f));
foo fo = reader.read(foo.class);
System.out.println(fo.getFooBytes());
}
//my file foo.yml
fooBytes: NewYork
--
--
You received this message because you are subscribed to the "yamlbeans-users" group:
http://groups.google.com/group/yamlbeans-users
---
You received this message because you are subscribed to the Google Groups "yamlbeans-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yamlbeans-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.