Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot

...

Code Block
bgColor#FFCCCC
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
bgColor#CCCCFF
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