@Override public void writeBatch() throws IOException {
  if (getInstances() == null) {
    throw new IOException("No instances to save");
  }
  if (getRetrieval() == INCREMENTAL) {
    throw new IOException("Batch and incremental saving cannot be mixed.");
  }
  setRetrieval(BATCH);
  setWriteMode(WRITE);
  PrintWriter outW;
  if ((retrieveFile() == null) && (getWriter() == null)) {
    outW=new PrintWriter(System.out);
  }
 else {
    outW=new PrintWriter(getWriter());
  }
  JSONNode json=JSONInstances.toJSON(getInstances());
  StringBuffer buffer=new StringBuffer();
  json.toString(buffer);
  outW.println(buffer.toString());
  outW.flush();
  if (getWriter() != null) {
    outW.close();
  }
  setWriteMode(WAIT);
  outW=null;
  resetWriter();
  setWriteMode(CANCEL);
}

@ Override public void writeBatch ( ) throws IOException { if ( getInstances ( ) == null ) { throw new IOException ( "No instances to save" ) ; } if ( getRetrieval ( ) == INCREMENTAL ) { throw new IOException ( "Batch and incremental saving cannot be mixed." ) ; } setRetrieval ( BATCH ) ; setWriteMode ( WRITE ) ; PrintWriter outW ; if ( ( retrieveFile ( ) == null ) && ( getWriter ( ) == null ) ) { outW = new PrintWriter ( System . out ) ; } else { outW = new PrintWriter ( getWriter ( ) ) ; } JSONNode json = JSONInstances . toJSON ( getInstances ( ) ) ; StringBuffer buffer = new StringBuffer ( ) ; json . toString ( buffer ) ; outW . println ( buffer . toString ( ) ) ; outW . flush ( ) ; if ( getWriter ( ) != null ) { outW . close ( ) ; } setWriteMode ( WAIT ) ; outW = null ; resetWriter ( ) ; setWriteMode ( CANCEL ) ; }
writes a batch of instances .
