Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: 1st CS bugfix

...

Code Block
bgColor#ccccff
public static String readBytes(InputStream in) throws IOException {
  int offset = 0;
  int bytesRead = 0;
  byte[] data = new byte[1024];
  while ((bytesRead = in.read(data, offset, data.length - offset))
    != -1) {
    offset += bytesRead;
    if (offset >= data.length) {
      break;
    }
  }
  String str = new String(data, 0, offset, "UTF-8");
  return str;
}

Compliant Solution (readFully())

...