summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-08-06 15:57:35 +0200
committersnowleo <schneeleo@gmail.com>2012-08-06 15:57:54 +0200
commitc2db96edc81568c7f5bfd1933662fbcb21ba6f6e (patch)
treeda1a2583c5ae857455aff5bae871e26f8d1d531f
parent4ca09cea2d630c7f509fa7fed17622a0103bef98 (diff)
downloadEssentials-c2db96edc81568c7f5bfd1933662fbcb21ba6f6e.tar
Essentials-c2db96edc81568c7f5bfd1933662fbcb21ba6f6e.tar.gz
Essentials-c2db96edc81568c7f5bfd1933662fbcb21ba6f6e.tar.lz
Essentials-c2db96edc81568c7f5bfd1933662fbcb21ba6f6e.tar.xz
Essentials-c2db96edc81568c7f5bfd1933662fbcb21ba6f6e.zip
Just don't use nio, this might be slower.
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsConf.java23
1 files changed, 4 insertions, 19 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
index c1c7d0a58..0440febce 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
@@ -39,6 +39,7 @@ public class EssentialsConf extends YamlConfiguration
super();
this.configFile = configFile;
}
+ private final byte[] bytebuffer = new byte[1024];
public synchronized void load()
{
@@ -117,27 +118,11 @@ public class EssentialsConf extends YamlConfiguration
try
{
final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length());
- int retry = 0;
- do
+ int length;
+ while ((length = inputStream.read(bytebuffer)) != -1)
{
- final FileChannel channel = inputStream.getChannel();
- channel.position(0);
- try
- {
- channel.read(buffer);
- retry = 0;
- }
- catch (ClosedByInterruptException ex)
- {
- buffer.rewind();
- retry++;
- if (retry >= 5)
- {
- throw ex;
- }
- }
+ buffer.put(bytebuffer, 0, length);
}
- while (retry > 0);
buffer.rewind();
final CharBuffer data = CharBuffer.allocate((int)configFile.length());
CharsetDecoder decoder = UTF8.newDecoder();