* revert to use plain xml files (not gzipped) for history files

This commit is contained in:
Reinhard Pointner 2009-05-23 18:27:35 +00:00
parent 2963baa889
commit fe37b816d1
4 changed files with 9 additions and 35 deletions

View File

@ -92,6 +92,9 @@ public class ListPanel extends JComponent {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
// clear selection
list.getListComponent().clearSelection();
int from = fromSpinnerModel.getNumber().intValue(); int from = fromSpinnerModel.getNumber().intValue();
int to = toSpinnerModel.getNumber().intValue(); int to = toSpinnerModel.getNumber().intValue();

View File

@ -4,20 +4,13 @@ package net.sourceforge.filebot.ui.panel.rename;
import static java.util.Collections.*; import static java.util.Collections.*;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
@ -198,14 +191,7 @@ class History {
Marshaller marshaller = JAXBContext.newInstance(History.class).createMarshaller(); Marshaller marshaller = JAXBContext.newInstance(History.class).createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
// write gzipped xml marshaller.marshal(history, file);
OutputStream out = new GZIPOutputStream(new FileOutputStream(file), 32 * 1024);
try {
marshaller.marshal(history, out);
} finally {
out.close();
}
} catch (JAXBException e) { } catch (JAXBException e) {
throw new IOException(e); throw new IOException(e);
} }
@ -216,22 +202,7 @@ class History {
try { try {
Unmarshaller unmarshaller = JAXBContext.newInstance(History.class).createUnmarshaller(); Unmarshaller unmarshaller = JAXBContext.newInstance(History.class).createUnmarshaller();
// GZIPInputStream or BufferedInputStream return ((History) unmarshaller.unmarshal(file));
InputStream in;
try {
// read gzipped xml
in = new GZIPInputStream(new FileInputStream(file), 32 * 1024);
} catch (IOException e) {
// file is not gzipped, read uncompressed xml instead
in = new BufferedInputStream(new FileInputStream(file));
}
try {
return ((History) unmarshaller.unmarshal(in));
} finally {
in.close();
}
} catch (JAXBException e) { } catch (JAXBException e) {
throw new IOException(e); throw new IOException(e);
} }

View File

@ -548,7 +548,7 @@ class HistoryDialog extends JDialog {
@Override @Override
protected boolean accept(List<File> files) { protected boolean accept(List<File> files) {
return FileUtilities.containsOnly(files, new ExtensionFileFilter("xml", "gz")); return FileUtilities.containsOnly(files, new ExtensionFileFilter("xml"));
} }
@ -575,7 +575,7 @@ class HistoryDialog extends JDialog {
@Override @Override
public String getFileFilterDescription() { public String getFileFilterDescription() {
return "history files (.xml.gz)"; return "history files (.xml)";
} }
}; };
@ -596,7 +596,7 @@ class HistoryDialog extends JDialog {
@Override @Override
public String getDefaultFileName() { public String getDefaultFileName() {
return "history.xml.gz"; return "history.xml";
} }
}; };

View File

@ -20,7 +20,7 @@ final class HistorySpooler {
return instance; return instance;
} }
private final File file = new File("history.xml.gz"); private final File file = new File("history.xml");
private final History sessionHistory = new History(); private final History sessionHistory = new History();