In this chapter we will investigate how we can read files containing basic types of data. We will be exploring how to read files sequentially or at random, and how we can open a file for both read and write operations.
In this chapter you will learn:
How to obtain a file channel for reading a file.
How to use buffers in file channel read operations.
How to read different types of data from a file.
How to retrieve data from random positions in a file.
How you can read and write the same file.
How you can do direct data transfer between channels.
What a memory-mapped file is and how you can access a memory-mapped file.
What a file lock is and how you can lock all or part of a file.