Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 10
    or use "try-with-resources" try(FileReader reader = new FileReader(file)) Commented Jan 16, 2014 at 13:04
  • 3
    I noticed the file.length(), How well does this work with utf-16 files? Commented Jan 30, 2014 at 3:02
  • 5
    This technique assumes that read() fills the buffer; that the number of chars equals the number of bytes; that the number of bytes fits into memory; and that the number of bytes fits into an integer. -1 Commented Aug 28, 2014 at 10:01
  • 1
    @HermesTrismegistus I provided four reasons why it is wrong. StefanReich is perfectly correct to agree with me. Commented Feb 4, 2018 at 8:40