mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
Just don't use nio, this might be slower.
This commit is contained in:
parent
4ca09cea2d
commit
c2db96edc8
1 changed files with 4 additions and 19 deletions
|
@ -39,6 +39,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||||
super();
|
super();
|
||||||
this.configFile = configFile;
|
this.configFile = configFile;
|
||||||
}
|
}
|
||||||
|
private final byte[] bytebuffer = new byte[1024];
|
||||||
|
|
||||||
public synchronized void load()
|
public synchronized void load()
|
||||||
{
|
{
|
||||||
|
@ -117,27 +118,11 @@ public class EssentialsConf extends YamlConfiguration
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length());
|
final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length());
|
||||||
int retry = 0;
|
int length;
|
||||||
do
|
while ((length = inputStream.read(bytebuffer)) != -1)
|
||||||
{
|
{
|
||||||
final FileChannel channel = inputStream.getChannel();
|
buffer.put(bytebuffer, 0, length);
|
||||||
channel.position(0);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
channel.read(buffer);
|
|
||||||
retry = 0;
|
|
||||||
}
|
}
|
||||||
catch (ClosedByInterruptException ex)
|
|
||||||
{
|
|
||||||
buffer.rewind();
|
|
||||||
retry++;
|
|
||||||
if (retry >= 5)
|
|
||||||
{
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (retry > 0);
|
|
||||||
buffer.rewind();
|
buffer.rewind();
|
||||||
final CharBuffer data = CharBuffer.allocate((int)configFile.length());
|
final CharBuffer data = CharBuffer.allocate((int)configFile.length());
|
||||||
CharsetDecoder decoder = UTF8.newDecoder();
|
CharsetDecoder decoder = UTF8.newDecoder();
|
||||||
|
|
Loading…
Reference in a new issue