...
Code Block | ||
---|---|---|
| ||
try { FileInputStream fis = new FileInputStream("SomeFile"); DataInputStream dis = new DataInputStream(fis); byte[] data = new byte[1024]; dis.readFully(data); String encoding = "SomeEncoding"; // for example, "UTF-16LE" String result = new String(data, encoding); } catch (IOException x) { // handle error } |
Exceptions
FIO03IDS17-EX1EX0: An explicit character encoding may be omitted on the receiving side when the data was produced by a Java application that uses the same platform and default character encoding.
...