Don't Make This Mistake:
  • Do not forget to open your input/output files in your primitive's open method before reading from it, otherwise you will get an Exception.
public int open() {
  inFile = MA.getFile("IN");
  inFile.open(); // do this before reading in the next line

  outFile = MA.getFile("OUT);
  outFile.open();
  ...
}