NIOFileHandle: cache file length when possible

This prevents many calls to raf.length() when working with read-only
files (where the length is expected to not change).