AsynchronousFileChannel end of file
Tim Fox
timvolpe at gmail.com
Wed Aug 3 22:42:00 PDT 2011
Hello,
It's not clear to me how to tell if I have read to end of file using
AsynchronousFileChannel.read().
The javadoc mentions that if -1 is returned as number of bytes read than
that means the position was >= file size at time of read.
However, if the read returns less bytes read than the limit of the
ByteBuffer passed in, does that also signify end of file was reached, or
is it sometimes possible to get partial reads that don't fill the buffer
even though there is more data in the file to read?
In other words, do I always have to issue reads until I received bytes
read == -1?
Thanks again.
More information about the nio-discuss
mailing list