01: package com.tagtraum.perf.gcviewer;
02:
03: import com.tagtraum.perf.gcviewer.exp.CSVDataWriter;
04: import com.tagtraum.perf.gcviewer.exp.PlainDataWriter;
05:
06: import java.io.File;
07: import java.io.FileOutputStream;
08: import java.io.IOException;
09: import java.util.ResourceBundle;
10:
11: /**
12: *
13: * Date: Feb 1, 2002
14: * Time: 10:34:39 AM
15: * @author <a href="mailto:hs@tagtraum.com">Hendrik Schreiber</a>
16: * @version $Id: $
17: */
18: public class DataWriterFactory {
19:
20: private static ResourceBundle localStrings = ResourceBundle
21: .getBundle("com.tagtraum.perf.gcviewer.localStrings");
22:
23: public DataWriter getDataWriter(File file, String extension)
24: throws IOException {
25: if (extension.equals(".csv")) {
26: return new CSVDataWriter(new FileOutputStream(file));
27: } else if (extension.equals(".txt")) {
28: return new PlainDataWriter(new FileOutputStream(file));
29: } else
30: throw new IOException(
31: localStrings
32: .getString("datawriterfactory_instantiation_failed")
33: + " " + file);
34: }
35:
36: }
|