/** * Writes a Batch of instances. * * @throws IOException throws IOException if saving in batch mode is not possible */ public void writeBatch() throws IOException { if(getRetrieval() == INCREMENTAL) throw new IOException("Batch and incremental saving cannot be mixed."); if(getInstances() == null) throw new IOException("No instances to save"); setRetrieval(BATCH); if (m_objectstream == null) throw new IOException("No output for serialization."); setWriteMode(WRITE); m_objectstream.writeObject(getInstances()); m_objectstream.flush(); m_objectstream.close(); setWriteMode(WAIT); resetWriter(); setWriteMode(CANCEL); }
/** * Writes a Batch of instances. * * @throws IOException throws IOException if saving in batch mode is not possible */ public void writeBatch() throws IOException { if(getRetrieval() == INCREMENTAL) throw new IOException("Batch and incremental saving cannot be mixed."); if(getInstances() == null) throw new IOException("No instances to save"); setRetrieval(BATCH); if (m_objectstream == null) throw new IOException("No output for serialization."); setWriteMode(WRITE); m_objectstream.writeObject(getInstances()); m_objectstream.flush(); m_objectstream.close(); setWriteMode(WAIT); resetWriter(); setWriteMode(CANCEL); }