01: /*
02: * DefaultOutputFactory.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.util;
13:
14: import java.io.File;
15: import java.io.FileOutputStream;
16: import java.io.IOException;
17: import java.io.OutputStream;
18: import java.io.Writer;
19:
20: /**
21: *
22: * @author support@sql-workbench.net
23: */
24: public class DefaultOutputFactory implements OutputFactory {
25:
26: public DefaultOutputFactory() {
27: }
28:
29: public boolean isArchive() {
30: return false;
31: }
32:
33: public OutputStream createOutputStream(File output)
34: throws IOException {
35: return new FileOutputStream(output);
36: }
37:
38: public Writer createWriter(File output, String encoding)
39: throws IOException {
40: OutputStream out = createOutputStream(output);
41: return EncodingUtil.createWriter(out, encoding);
42: }
43:
44: public Writer createWriter(String filename, String encoding)
45: throws IOException {
46: return createWriter(new File(filename), encoding);
47: }
48:
49: public void done() throws IOException {
50: }
51:
52: }
|