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; }
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(); }