1
2
3
4
5
6
7 package org.astrogrid.tableserver.out;
8
9 import org.astrogrid.tableserver.metadata.*;
10
11 import java.io.IOException;
12
13 /***
14 * Similar to FilteredInputStream, an instance of this class 'wraps' around another
15 * table writer, and forwards all calls to that writer. Subclasses therefore can
16 * override particular calls to transform the information on the way through.
17 *
18 * For example, the value of a particular column might be altered, or new calculated
19 * columns added
20 *
21 * @author M Hill
22 */
23
24 public abstract class FilteredTableWriter {
25
26 protected TableWriter writer;
27
28
29 protected FilteredTableWriter(TableWriter targetWriter) {
30 this.writer = writer;
31 }
32
33 /*** Sets all the column details */
34 public void startTable(ColumnInfo[] colInfo) throws IOException {
35 writer.startTable(colInfo);
36 }
37
38 /*** Writes the given array of values out */
39 public void writeRow(Object[] colValues) throws IOException {
40 writer.writeRow(colValues);
41 }
42
43 /*** Ends a table (eg closes tags) */
44 public void endTable() throws IOException {
45 writer.endTable();
46 }
47
48 /*** Close the writer */
49 public void close() throws IOException {
50 writer.close();
51 }
52
53 /*** If the writer needs to stop before normal completion, call this. It will,
54 * if appropriate, write some message to indicate that the table is incomplete */
55 public void abort() throws IOException {
56 writer.abort();
57 }
58
59 /*** Returns the mime type that this writer produces */
60 public String getMimeType() {
61 return writer.getMimeType();
62 }
63 }
64
65