Search in sources :

Example 1 with RobustFileWriter

use of net.sourceforge.processdash.util.RobustFileWriter in project processdash by dtuma.

the class CustomColumnManager method exportColumns.

public void exportColumns(File dest) throws IOException {
    BufferedWriter out = new BufferedWriter(new RobustFileWriter(dest, "UTF-8"));
    projectColumnSpecs.getAsXML(out);
    out.close();
}
Also used : RobustFileWriter(net.sourceforge.processdash.util.RobustFileWriter) BufferedWriter(java.io.BufferedWriter)

Example 2 with RobustFileWriter

use of net.sourceforge.processdash.util.RobustFileWriter in project processdash by dtuma.

the class WBSLibrary method save.

public void save() throws IOException {
    try {
        if (file == null)
            throw new IOException("Attempting to save nonfile library");
        RobustFileWriter out = new RobustFileWriter(file, "UTF-8");
        out.write("<" + getRootTag() + " ");
        out.write(PROCESS_NAME_ATTR + "='" + XMLUtils.escapeAttribute(processName) + "' ");
        out.write(PROCESS_VERSION_ATTR + "='" + XMLUtils.escapeAttribute(processVersion) + "' ");
        out.write(LIBRARY_ID_ATTR + "='" + XMLUtils.escapeAttribute(getLibraryID()) + "' ");
        out.write(EXPORT_TIMESTAMP_ATTR + "='" + XMLUtils.saveDate(new Date()) + "'>\n");
        wbs.getAsXML(out);
        out.write("</" + getRootTag() + ">");
        out.close();
    } catch (IOException ioe) {
        throw ioe;
    } catch (Exception e) {
        IOException ioe = new IOException("Unable to save library.");
        ioe.initCause(e);
        throw ioe;
    }
}
Also used : IOException(java.io.IOException) RobustFileWriter(net.sourceforge.processdash.util.RobustFileWriter) Date(java.util.Date) IOException(java.io.IOException)

Example 3 with RobustFileWriter

use of net.sourceforge.processdash.util.RobustFileWriter in project processdash by dtuma.

the class DefectLog method saveAsTabDelimited.

private boolean saveAsTabDelimited(Defect[] defects) {
    boolean savedSuccessfully = true;
    try {
        File defectFile = new File(defectLogFilename);
        Writer out = new BufferedWriter(new RobustFileWriter(defectFile));
        // write the defect info
        String newLine = System.getProperty("line.separator");
        if (defects != null)
            for (int i = 0; i < defects.length; i++) if (defects[i] != null) {
                if (defects[i].needsXmlSaveFormat())
                    savedSuccessfully = false;
                out.write(defects[i].toString());
                out.write(newLine);
            }
        out.close();
    } catch (IOException e) {
        System.out.println("IOException: " + e);
    }
    ;
    return savedSuccessfully;
}
Also used : RobustFileWriter(net.sourceforge.processdash.util.RobustFileWriter) IOException(java.io.IOException) File(java.io.File) BufferedWriter(java.io.BufferedWriter) RobustFileWriter(net.sourceforge.processdash.util.RobustFileWriter) Writer(java.io.Writer) BufferedWriter(java.io.BufferedWriter)

Example 4 with RobustFileWriter

use of net.sourceforge.processdash.util.RobustFileWriter in project processdash by dtuma.

the class TimeLogModifications method save.

public synchronized boolean save() {
    if (saveFile == null || Settings.isReadOnly())
        return false;
    try {
        RobustFileWriter out = new RobustFileWriter(saveFile, "UTF-8");
        Iterator entries = new IteratorConcatenator(//
        new RenamingOperationsIterator(), modifications.values().iterator());
        TimeLogWriter.write(out, entries);
        saveFileTimestamp = saveFile.lastModified();
        dirty = false;
        return true;
    } catch (IOException ioe) {
        System.err.println("Unable to save time log modifications to file '" + saveFile + "'");
        ioe.printStackTrace();
        return false;
    }
}
Also used : Iterator(java.util.Iterator) EnumerIterator(net.sourceforge.processdash.util.EnumerIterator) IteratorConcatenator(net.sourceforge.processdash.util.IteratorConcatenator) RobustFileWriter(net.sourceforge.processdash.util.RobustFileWriter) IOException(java.io.IOException)

Example 5 with RobustFileWriter

use of net.sourceforge.processdash.util.RobustFileWriter in project processdash by dtuma.

the class MigrationToolIndiv method saveDataFile.

private void saveDataFile(File dataFile, List<StringBuffer> data) throws IOException {
    BufferedWriter out = new BufferedWriter(new RobustFileWriter(dataFile));
    for (StringBuffer line : data) {
        if (line.length() > 0) {
            out.write(line.toString());
            out.newLine();
        }
    }
    out.close();
}
Also used : RobustFileWriter(net.sourceforge.processdash.util.RobustFileWriter) BufferedWriter(java.io.BufferedWriter)

Aggregations

RobustFileWriter (net.sourceforge.processdash.util.RobustFileWriter)22 BufferedWriter (java.io.BufferedWriter)17 File (java.io.File)11 IOException (java.io.IOException)11 Writer (java.io.Writer)6 InputStreamReader (java.io.InputStreamReader)2 Iterator (java.util.Iterator)2 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 PrintWriter (java.io.PrintWriter)1 Reader (java.io.Reader)1 MalformedURLException (java.net.MalformedURLException)1 PrivilegedAction (java.security.PrivilegedAction)1 Date (java.util.Date)1 Enumeration (java.util.Enumeration)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 DefaultTableColumnModel (javax.swing.table.DefaultTableColumnModel)1