1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.datacenter.queriers.xql;
12
13 import java.io.*;
14
15 import org.astrogrid.datacenter.queriers.Querier;
16 import org.astrogrid.datacenter.queriers.QueryResults;
17 import org.astrogrid.datacenter.queriers.status.QuerierProcessingResults;
18 import org.astrogrid.io.Piper;
19
20 /***
21 * A results wrapper around an XML document stream
22 *
23 */
24 public class XmlResults extends QueryResults {
25
26 protected final InputStream in;
27
28 /*** Std Constructor. xmlIn is a stream containing the xml document
29 */
30 public XmlResults(Querier querier, InputStream xmlIn) {
31 super(querier);
32 this.in = xmlIn;
33 }
34
35 /*** Constructor where the xml doc is in the given File
36 */
37 public XmlResults(Querier querier, File xmlFile) throws IOException {
38 super(querier);
39 this.in = new FileInputStream(xmlFile);
40 }
41
42 public int getCount() {
43 return -1;
44 }
45
46 /***
47 * Writes out raw - as is
48 */
49 public void writeRaw(Writer out, QuerierProcessingResults querierStatus) throws IOException {
50 Piper.bufferedPipe(new InputStreamReader(in), out);
51 }
52
53 /***
54 * writes out in Votable
55 */
56 public void writeVotable(Writer out, QuerierProcessingResults querierStatus) throws IOException {
57 throw new UnsupportedOperationException("Not yet implemeneted");
58 }
59
60 /***
61 * writes out in HTML
62 */
63 public void writeHtml(Writer out, QuerierProcessingResults querierStatus) throws IOException {
64 throw new UnsupportedOperationException("Not yet implemeneted");
65 }
66
67 /***
68 * writes out in CSV form
69 */
70 public void writeCSV(Writer out, QuerierProcessingResults querierStatus) throws IOException {
71 throw new UnsupportedOperationException("Not yet implemeneted");
72 }
73
74 }
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115