5

In Java 11 BufferedReader documentation I have found following sentence:

Programs that use DataInputStreams for textual input can be localized by replacing each DataInputStream with an appropriate BufferedReader.

I cannot find any explanation how it can be done - what would be an appropriate buffered reader in this context?

Line
  • 1,529
  • 3
  • 18
  • 42
  • Just a guess: I looked at [`DataInputStream.readLine`](https://docs.oracle.com/javase/7/docs/api/java/io/DataInputStream.html#readLine()) and found that it doesn't convert bytes to characters properly. "Localised" here could just mean "handles Unicode properly". I don't think the word "appropriate" is that important here. It just refers to a buffered reader that reads from the `DataInputStream` – Sweeper Feb 13 '21 at 09:30
  • Please find those links which could help you [Link_1](https://zetcode.com/java/inputstream/), [Link_2](https://www.geeksforgeeks.org/java-io-bufferedreader-class-java/) – Mohamed Bdr Feb 13 '21 at 09:34

1 Answers1

6

Yes, it's a really bizarre (I'd say broken) use of the term 'localization' here - it's making an obscure (in that it doesn't link to it) reference to DataInputStream's known-broken readLine method, especially considering that this method's javadoc explicitly refers to BufferedReader. I assume that line was added at the same time as the 'can be used to localize' line was added to BR's javadoc.

Line
  • 1,529
  • 3
  • 18
  • 42
rzwitserloot
  • 85,357
  • 5
  • 51
  • 72