1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.whatsnew.filter.impl;
17
18 import java.io.File;
19 import java.io.FileWriter;
20 import java.io.IOException;
21 import java.io.Writer;
22
23 import net.sf.whatsnew.exceptions.AppException;
24 import net.sf.whatsnew.filter.OutputWriter;
25
26
27 /***
28 * <p>
29 * An OutputWriter implementation that plain the buffer using DOS line feeds
30 * </p>
31 *
32 * @author <a href="mailto:dquintela@users.sourceforge.net">Diogo Quintela</a>
33 * @version $Id: DosOutputWriter.java,v 1.1 2004/05/13 01:22:35 dquintela Exp $
34 */
35 public class DosOutputWriter
36 implements OutputWriter {
37 /***
38 * Plains the array
39 *
40 * @param outputFile The file write to
41 * @param input The array to process
42 *
43 * @throws AppException in case of error
44 */
45 public void output(
46 File outputFile,
47 String[] input)
48 throws AppException {
49 try {
50 Writer out = new FileWriter(outputFile);
51 try {
52 for (int i = 0; i < input.length; i++) {
53 out.write(input[i]);
54 out.write("\r\n");
55 }
56 out.flush();
57 } finally {
58 out.close();
59 }
60 } catch (IOException ex) {
61 throw new AppException(ex.getMessage());
62 }
63 }
64 }
65