code: public void writeToFile(String filename) throws IOException {
          FileOutputStream fos = new FileOutputStream(filename);
          writeToStream(fos);
          fos.close();
      }
docs: Convenience function to write the current state of the modelBatch out to a file, including all factors.
  
  WARNING: These files can get quite large, if you're using large embeddings as features.
  
  @param filename the file to write the batch to
  @throws IOException