code: static void readAllBytesOrFail(InputStream in, byte[] buffer)
        throws IOException {
      int read = readAllBytes(in, buffer);
      if (read != buffer.length) {
        throw new EOFException(String.format(
            "Expected %d bytes but read %d bytes.", buffer.length, read));
      }
    }
docs: Fills the buffer from the input stream. Throws exception if EOF occurs
  before buffer is filled.
  
  @param in
  the input stream
  @param buffer
  the buffer to fill
  @throws IOException