if (evt.getActionCommand().equals(JFileChooser.APPROVE_SELECTION)) {
File f = chooser.getSelectedFile();
if (f != null) {
theView.reset();
try {
InputStream in = new FileInputStream(f);
// This program was really slow until I buffered the stream.
in = new BufferedInputStream(in);
in = new ProgressMonitorInputStream(this, "Reading...", in);
if (!mp.isText()) {
FileDumper6.dump(in, theView.getWriter(), mp.getMode(),
mp.isBigEndian(),
mp.isDeflated(), mp.isGZipped(), mp.getPassword());
}
else {
FileDumper6.dump(in, theView.getWriter(), mp.getEncoding(), null,
mp.isDeflated(), mp.isGZipped(), mp.getPassword());
}
}
catch (IOException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(),
"I/O Error", JOptionPane.ERROR_MESSAGE);
}
}
}
else if (evt.getActionCommand().equals(JFileChooser.CANCEL_SELECTION)) {
this.setVisible(false);
this.dispose();
// This is a single window application
System.exit(0);
}