Best way to get a few bytes from a java.nio.FileChannel'ed file...

S

Spendius

Hi,
What do you think is the best way to read a few bytes
from a file that's been loaded up a FileChannel ? Should
I necessarily map it (I only need a few tens of bytes, even
when my file is several hundreds of megs big !) ? Or should
I use one of the 4 'read()' methods the FileChannel class
provides ? If so, how should instantiate the ByteBuffer
required to work with these 'read()' methods ? And what's
its use actually ?
(in fact I don't want to map my files, because they may
happen to be pretty large -several hundreds of megs-, and
mapping them would force me to lay down some algorithm to
deal with the files size in order to map them by chunks...)

Thanks in advance !
Regards,
Spendius
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top