Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Imagine you are reading files which can be of varying size (KB to GB). A byte array will do a contiguous allocation of the file size.

A Reader can be much more thoughtful. And I say "can be" because someone can make Reader as inefficient as a byte array.

Or they can read in chunks.

For example, if you are trying you read exif data or reading up to first N bytes, Reader is a superior approach.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: