/** * Main method. * * @param args should contain the options of a Saver. */ public static void main(String[] args) { runFileSaver(new XRFFSaver(), args); } }
/** * Constructor */ public XRFFSaver() { resetOptions(); }
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); m_XMLInstances.setInstances(getInstances()); if ((retrieveFile() == null) && (getWriter() == null)) { System.out.println(m_XMLInstances.toString()); setWriteMode(WAIT); } else { PrintWriter outW = new PrintWriter(getWriter()); outW.println(m_XMLInstances.toString()); outW.flush(); outW.close(); setWriteMode(WAIT); outW = null; resetWriter(); setWriteMode(CANCEL);
/** * returns the saver used in the tests * * @return the configured saver */ public AbstractSaver getSaver() { return new XRFFSaver(); }
/** * Resets the Saver */ @Override public void resetOptions() { super.resetOptions(); if (getCompressOutput()) { setFileExtension(XRFFLoader.FILE_EXTENSION_COMPRESSED); } else { setFileExtension(XRFFLoader.FILE_EXTENSION); } try { m_XMLInstances = new XMLInstances(); } catch (Exception e) { m_XMLInstances = null; } }
/** * returns the options of the current setup * * @return the current options */ @Override public String[] getOptions() { Vector<String> result = new Vector<String>(); if (getClassIndex().length() != 0) { result.add("-C"); result.add(getClassIndex()); } if (getCompressOutput()) { result.add("-compress"); } Collections.addAll(result, super.getOptions()); return result.toArray(new String[result.size()]); }
/** * Sets the destination output stream. * * @param output the output stream. * @throws IOException throws an IOException if destination cannot be set */ @Override public void setDestination(OutputStream output) throws IOException { if (getCompressOutput()) { super.setDestination(new GZIPOutputStream(output)); } else { super.setDestination(output); } }
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); m_XMLInstances.setInstances(getInstances()); if ((retrieveFile() == null) && (getWriter() == null)) { System.out.println(m_XMLInstances.toString()); setWriteMode(WAIT); } else { PrintWriter outW = new PrintWriter(getWriter()); outW.println(m_XMLInstances.toString()); outW.flush(); outW.close(); setWriteMode(WAIT); outW = null; resetWriter(); setWriteMode(CANCEL);
/** * returns the saver used in the tests * * @return the configured saver */ public AbstractSaver getSaver() { return new XRFFSaver(); }
/** * Resets the Saver */ @Override public void resetOptions() { super.resetOptions(); if (getCompressOutput()) { setFileExtension(XRFFLoader.FILE_EXTENSION_COMPRESSED); } else { setFileExtension(XRFFLoader.FILE_EXTENSION); } try { m_XMLInstances = new XMLInstances(); } catch (Exception e) { m_XMLInstances = null; } }
/** * returns the options of the current setup * * @return the current options */ @Override public String[] getOptions() { Vector<String> result = new Vector<String>(); if (getClassIndex().length() != 0) { result.add("-C"); result.add(getClassIndex()); } if (getCompressOutput()) { result.add("-compress"); } Collections.addAll(result, super.getOptions()); return result.toArray(new String[result.size()]); }
/** * Sets the destination output stream. * * @param output the output stream. * @throws IOException throws an IOException if destination cannot be set */ @Override public void setDestination(OutputStream output) throws IOException { if (getCompressOutput()) { super.setDestination(new GZIPOutputStream(output)); } else { super.setDestination(output); } }
/** * Main method. * * @param args should contain the options of a Saver. */ public static void main(String[] args) { runFileSaver(new XRFFSaver(), args); } }
/** * Constructor */ public XRFFSaver() { resetOptions(); }