Ejemplo n.º 1
0
  public Locale readFromFile(AbsolutePath<FileSystem> cfg_file_path) throws IOException {

    byte[] bytes = cfg_file_path.getMountPoint().newFile(cfg_file_path).readBytes();

    SimpleLocale locale = Json.deserializeFromString(SimpleLocale.class, new String(bytes));

    return locale;
  }
Ejemplo n.º 2
0
  public void writeToFile(AbsolutePath<FileSystem> cfg_file_path, Locale locale)
      throws IOException {

    String serialized_locale = Json.serializeToString(locale);

    FileOutputStream os = cfg_file_path.getMountPoint().newFile(cfg_file_path).newOutputStream();
    os.write(serialized_locale.getBytes());
    os.flush();
    os.close();
  }