diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-10 22:55:11 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-10 22:55:11 +0000 |
commit | 471e20473bcc941998ef0319a9eab771e8330a97 (patch) | |
tree | 9cc4c1816a6e9f527ff8134309a9ffcb5f2928de /EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java | |
parent | 27a3d0a9a1c1f76de17a4174bf0e4df657cda9c6 (diff) | |
download | Essentials-471e20473bcc941998ef0319a9eab771e8330a97.tar Essentials-471e20473bcc941998ef0319a9eab771e8330a97.tar.gz Essentials-471e20473bcc941998ef0319a9eab771e8330a97.tar.lz Essentials-471e20473bcc941998ef0319a9eab771e8330a97.tar.xz Essentials-471e20473bcc941998ef0319a9eab771e8330a97.zip |
[trunk] GroupManager: Support utf-8 for saving files.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1170 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 96e517abd..d68e8efd8 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -7,8 +7,11 @@ package org.anjocaido.groupmanager.dataholder; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -756,8 +759,13 @@ public class WorldDataHolder { DumperOptions opt = new DumperOptions(); opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); final Yaml yaml = new Yaml(opt); + try { + yaml.dump(root, new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8")); + } catch (UnsupportedEncodingException ex) { + } catch (FileNotFoundException ex) { + } - FileWriter tx = null; + /*FileWriter tx = null; try { tx = new FileWriter(groupsFile, false); tx.write(yaml.dump(root)); @@ -768,7 +776,7 @@ public class WorldDataHolder { tx.close(); } catch (IOException ex) { } - } + }*/ } /** @@ -813,8 +821,12 @@ public class WorldDataHolder { DumperOptions opt = new DumperOptions(); opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); final Yaml yaml = new Yaml(opt); - - FileWriter tx = null; + try { + yaml.dump(root, new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8")); + } catch (UnsupportedEncodingException ex) { + } catch (FileNotFoundException ex) { + } + /*FileWriter tx = null; try { tx = new FileWriter(usersFile, false); tx.write(yaml.dump(root)); @@ -825,7 +837,7 @@ public class WorldDataHolder { tx.close(); } catch (IOException ex) { } - } + }*/ } /** |