T
Timo Nentwig
Hi!
I probably yet don't understand some fundamental things about NIO. The
following code is painfully slow (8sec. for a 6MiB file):
final FileChannel in = new FileInputStream( f ).getChannel();
final ByteBuffer token = ByteBuffer.allocate( 4 );
while( in.position() < in.size() )
{
in.read( token );
final String s = new String( token.array() );
token.flip();
}
What am I doing wrong?
I probably yet don't understand some fundamental things about NIO. The
following code is painfully slow (8sec. for a 6MiB file):
final FileChannel in = new FileInputStream( f ).getChannel();
final ByteBuffer token = ByteBuffer.allocate( 4 );
while( in.position() < in.size() )
{
in.read( token );
final String s = new String( token.array() );
token.flip();
}
What am I doing wrong?