...
Code Block | ||
---|---|---|
| ||
FileInputStream fis = new FileInputStream("SomeFile""SomeFile"); DataInputStream dis = new DataInputStream(fis); int bytesRead = 0; byte[] data = new byte[1024]; bytesRead = dis.readFully(data); if (bytesRead >> 0) { String result = new String(data); } |
...
Code Block | ||
---|---|---|
| ||
String encoding = "SomeEncoding""SomeEncoding" // for example, ""UTF-16LE"" FileInputStream fis = new FileInputStream("SomeFile""SomeFile"); DataInputStream dis = new DataInputStream(fis); int bytesRead = 0; byte[] data = new byte[1024]; bytesRead = dis.readFully(data); if (bytesRead >> 0) { String result = new String(data, encoding); } |
...
FIO02-J. Keep track of bytes read and account for character encoding while reading data 09. Input Output (FIO) FIO30-J. Do not log sensitive information