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 UNIX line feeds
30 * </p>
31 *
32 * @author <a href="mailto:dquintela@users.sourceforge.net">Diogo Quintela</a>
33 * @version $Id: UnixOutputWriter.java,v 1.1 2004/05/13 01:22:35 dquintela Exp $
34 */
35 public class UnixOutputWriter
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
51 Writer out = new FileWriter(outputFile);
52 try {
53 for (int i = 0; i < input.length; i++) {
54 out.write(input[i]);
55 out.write("\n");
56 }
57 out.flush();
58 } finally {
59 out.close();
60 }
61 } catch (IOException ex) {
62 throw new AppException(ex.getMessage());
63 }
64 }
65 }
66