First page Back Continue Last page Overview Graphics
Case study II: Efficiently reading bytes from a large file
Although the read command of the FileInputStream class can actually directly read bytes from a file this is very very inefficient.
Any read/write operation from the disk usually involves the use of the Operating System (OS) and is therefore very time consuming.
The basic reading mechanism of the OS is built on reading much bigger chunks of data from the disk at once.
These chunks are called “Pages”. A typical page is of size ~4k (IS THIS TRUE TODAY???)
In our previous code snippet, we read “from the disk” byte by byte!