CharsetDecoder decoder = Charset.forName("ISO-8859-1").newDecoder();
FileChannel channel = new FileInputStream(pluginListFileName).getChannel();
ByteBuffer buffer = ByteBuffer.allocateDirect(1024);
CharBuffer pluginClassPath;
CharBuffer pluginName;
while (channel.read(buffer) != -1) {
buffer.flip();
pluginClassPath = decoder.decode(buffer);
if (channel.read(buffer) != -1) {
buffer.flip();
pluginName = decoder.decode(buffer);
}
}
Quando este códgio atinge o while ele entra em um loop interminável, porquê?
Aliás, eu nunca entendi a diferença direito entre allocate(int) e allocateDirect(int) e quando usar um ou outro.
Obrigado.