Hi all,
I came across the following problem: I'd like to read a file into a string so that each byte is converted to a character by just setting the MSB to '\0' and LSB to the byte itself. I know there is a way of doing that (readLine() from java.io.DataInputStream), but the specs say its deprecated:
Deprecated. This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method. Programs that use the DataInputStream class to read lines can be converted to use the BufferedReader class by replacing code of the form:
with:
I think, however, that the latter solution uses the default encoding to convert bytes to characters (that's what InputStreamReader is for anyway).
How to accomplish what I need without using deprecated methods?
Greg