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

Discussion in 'Java' started by Spendius, Sep 7, 2003.

  1. Spendius

    Spendius Guest

    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
    Spendius, Sep 7, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. iksrazal

    NIO with timeouts != NIO?

    iksrazal, Jun 17, 2004, in forum: Java
    Replies:
    1
    Views:
    6,218
    iksrazal
    Jun 18, 2004
  2. Replies:
    5
    Views:
    463
    Chris Uppal
    Mar 28, 2006
  3. Replies:
    2
    Views:
    2,673
    Andrey Kuznetsov
    May 16, 2006
  4. Murali
    Replies:
    2
    Views:
    543
    Jerry Coffin
    Mar 9, 2006
  5. ccc31807
    Replies:
    18
    Views:
    340
    Rainer Weikusat
    Jan 15, 2013
Loading...

Share This Page