7677 |
27 Mar 19 |
nicklas |
1 |
import java.io.BufferedReader; |
7677 |
27 Mar 19 |
nicklas |
2 |
import java.io.InputStream; |
7677 |
27 Mar 19 |
nicklas |
3 |
import java.io.InputStreamReader; |
7677 |
27 Mar 19 |
nicklas |
4 |
import java.io.OutputStream; |
7677 |
27 Mar 19 |
nicklas |
5 |
import java.time.LocalDate; |
7677 |
27 Mar 19 |
nicklas |
6 |
import java.time.ZoneId; |
7677 |
27 Mar 19 |
nicklas |
7 |
import java.util.Date; |
7677 |
27 Mar 19 |
nicklas |
8 |
import java.util.regex.Pattern; |
7677 |
27 Mar 19 |
nicklas |
9 |
|
7677 |
27 Mar 19 |
nicklas |
10 |
import org.apache.poi.ss.usermodel.CellStyle; |
7677 |
27 Mar 19 |
nicklas |
11 |
import org.apache.poi.ss.usermodel.Font; |
7677 |
27 Mar 19 |
nicklas |
12 |
import org.apache.poi.ss.usermodel.IndexedColors; |
7677 |
27 Mar 19 |
nicklas |
13 |
import org.apache.poi.ss.usermodel.Workbook; |
7677 |
27 Mar 19 |
nicklas |
14 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
7677 |
27 Mar 19 |
nicklas |
15 |
|
7677 |
27 Mar 19 |
nicklas |
16 |
import net.sf.basedb.util.FileUtil; |
7677 |
27 Mar 19 |
nicklas |
17 |
import net.sf.basedb.util.excel.CellStyleCreator; |
7677 |
27 Mar 19 |
nicklas |
18 |
import net.sf.basedb.util.excel.XlsxTableWriter; |
7677 |
27 Mar 19 |
nicklas |
19 |
import net.sf.basedb.util.excel.XlsxToCsvUtil; |
7677 |
27 Mar 19 |
nicklas |
20 |
import net.sf.basedb.util.excel.XlsxToCsvUtil.SheetInfo; |
7677 |
27 Mar 19 |
nicklas |
21 |
import net.sf.basedb.util.formatter.DateFormatter; |
7677 |
27 Mar 19 |
nicklas |
22 |
import net.sf.basedb.util.formatter.NumberFormatter; |
7677 |
27 Mar 19 |
nicklas |
23 |
import net.sf.basedb.util.parser.FlatFileParser; |
7677 |
27 Mar 19 |
nicklas |
24 |
import net.sf.basedb.util.parser.FlatFileParser.Data; |
7677 |
27 Mar 19 |
nicklas |
25 |
import net.sf.basedb.util.parser.FlatFileParser.Line; |
7677 |
27 Mar 19 |
nicklas |
26 |
|
7677 |
27 Mar 19 |
nicklas |
27 |
/* |
7677 |
27 Mar 19 |
nicklas |
$Id$ |
7677 |
27 Mar 19 |
nicklas |
29 |
|
7677 |
27 Mar 19 |
nicklas |
Copyright (C) 2019 Nicklas Nordborg |
7677 |
27 Mar 19 |
nicklas |
31 |
|
7677 |
27 Mar 19 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
7677 |
27 Mar 19 |
nicklas |
Available at http://base.thep.lu.se/ |
7677 |
27 Mar 19 |
nicklas |
34 |
|
7677 |
27 Mar 19 |
nicklas |
BASE is free software; you can redistribute it and/or |
7677 |
27 Mar 19 |
nicklas |
modify it under the terms of the GNU General Public License |
7677 |
27 Mar 19 |
nicklas |
as published by the Free Software Foundation; either version 3 |
7677 |
27 Mar 19 |
nicklas |
of the License, or (at your option) any later version. |
7677 |
27 Mar 19 |
nicklas |
39 |
|
7677 |
27 Mar 19 |
nicklas |
BASE is distributed in the hope that it will be useful, |
7677 |
27 Mar 19 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7677 |
27 Mar 19 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7677 |
27 Mar 19 |
nicklas |
GNU General Public License for more details. |
7677 |
27 Mar 19 |
nicklas |
44 |
|
7677 |
27 Mar 19 |
nicklas |
You should have received a copy of the GNU General Public License |
7677 |
27 Mar 19 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
7677 |
27 Mar 19 |
nicklas |
47 |
*/ |
7677 |
27 Mar 19 |
nicklas |
48 |
|
7677 |
27 Mar 19 |
nicklas |
49 |
public class TestExcelFunctions |
7677 |
27 Mar 19 |
nicklas |
50 |
{ |
7677 |
27 Mar 19 |
nicklas |
51 |
static boolean ok = true; |
7677 |
27 Mar 19 |
nicklas |
52 |
|
7677 |
27 Mar 19 |
nicklas |
53 |
public static void main(String[] args) |
7677 |
27 Mar 19 |
nicklas |
54 |
{ |
7677 |
27 Mar 19 |
nicklas |
55 |
TestUtil.checkArgs(args); |
7677 |
27 Mar 19 |
nicklas |
56 |
TestUtil.begin(); |
7677 |
27 Mar 19 |
nicklas |
57 |
ok = test_all(); |
7677 |
27 Mar 19 |
nicklas |
58 |
TestUtil.stop(); |
7677 |
27 Mar 19 |
nicklas |
59 |
} |
7677 |
27 Mar 19 |
nicklas |
60 |
|
7677 |
27 Mar 19 |
nicklas |
61 |
static boolean test_all() |
7677 |
27 Mar 19 |
nicklas |
62 |
{ |
7677 |
27 Mar 19 |
nicklas |
63 |
write("++Testing Excel functions"); |
7677 |
27 Mar 19 |
nicklas |
64 |
|
7677 |
27 Mar 19 |
nicklas |
65 |
test_create_xlsx(null, "data/test.xlsx", "Test"); // Creates a new workbook |
7677 |
27 Mar 19 |
nicklas |
66 |
test_read_xlsx("data/test.xlsx", "Test"); |
7677 |
27 Mar 19 |
nicklas |
67 |
test_read_xlsx_via_ffp("data/test.xlsx", "Test"); |
7677 |
27 Mar 19 |
nicklas |
68 |
|
7677 |
27 Mar 19 |
nicklas |
69 |
test_create_xlsx("data/test.xlsx", "data/test2.xlsx", "Test2"); // Adds a sheet to an existing workbook |
7677 |
27 Mar 19 |
nicklas |
70 |
test_read_xlsx("data/test2.xlsx", null); |
7677 |
27 Mar 19 |
nicklas |
71 |
test_read_xlsx_via_ffp("data/test2.xlsx", null); |
7677 |
27 Mar 19 |
nicklas |
72 |
|
7677 |
27 Mar 19 |
nicklas |
73 |
write("++Testing Excel functions " + (ok ? "OK" : "Failed") + "\n"); |
7677 |
27 Mar 19 |
nicklas |
74 |
return ok; |
7677 |
27 Mar 19 |
nicklas |
75 |
} |
7677 |
27 Mar 19 |
nicklas |
76 |
|
7677 |
27 Mar 19 |
nicklas |
77 |
|
7677 |
27 Mar 19 |
nicklas |
78 |
public static void test_create_xlsx(String inFile, String outFile, String name) |
7677 |
27 Mar 19 |
nicklas |
79 |
{ |
7677 |
27 Mar 19 |
nicklas |
80 |
OutputStream out = null; |
7728 |
14 Jun 19 |
nicklas |
81 |
Workbook workbook = null; |
7677 |
27 Mar 19 |
nicklas |
82 |
try |
7677 |
27 Mar 19 |
nicklas |
83 |
{ |
7677 |
27 Mar 19 |
nicklas |
84 |
if (inFile != null) |
7677 |
27 Mar 19 |
nicklas |
85 |
{ |
7677 |
27 Mar 19 |
nicklas |
86 |
workbook = new XSSFWorkbook(new java.io.File(inFile)); |
7677 |
27 Mar 19 |
nicklas |
87 |
} |
7677 |
27 Mar 19 |
nicklas |
88 |
|
7677 |
27 Mar 19 |
nicklas |
89 |
XlsxTableWriter tw = new XlsxTableWriter(workbook, name); |
7677 |
27 Mar 19 |
nicklas |
90 |
CellStyleCreator styleCreator = tw.getCellStyleCreator(); |
7677 |
27 Mar 19 |
nicklas |
91 |
|
7677 |
27 Mar 19 |
nicklas |
92 |
CellStyle headerStyle = styleCreator.createStyle(); |
7677 |
27 Mar 19 |
nicklas |
93 |
Font bold = styleCreator.createFont(); |
7677 |
27 Mar 19 |
nicklas |
94 |
bold.setBold(true); |
7677 |
27 Mar 19 |
nicklas |
95 |
headerStyle.setFont(bold); |
7677 |
27 Mar 19 |
nicklas |
96 |
|
7678 |
27 Mar 19 |
nicklas |
97 |
CellStyle commentStyle = styleCreator.createStyle(); |
7677 |
27 Mar 19 |
nicklas |
98 |
Font greyItalic = styleCreator.createFont(); |
7677 |
27 Mar 19 |
nicklas |
99 |
greyItalic.setItalic(true); |
7677 |
27 Mar 19 |
nicklas |
100 |
greyItalic.setColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
7678 |
27 Mar 19 |
nicklas |
101 |
commentStyle.setFont(greyItalic); |
7677 |
27 Mar 19 |
nicklas |
102 |
|
7677 |
27 Mar 19 |
nicklas |
103 |
Object[] data = new Object[7]; |
7677 |
27 Mar 19 |
nicklas |
// Headers |
7677 |
27 Mar 19 |
nicklas |
105 |
data[0] = "Name"; |
7677 |
27 Mar 19 |
nicklas |
106 |
data[1] = "Line"; |
7677 |
27 Mar 19 |
nicklas |
107 |
data[2] = "Age"; |
7677 |
27 Mar 19 |
nicklas |
108 |
data[3] = "Pi"; |
7677 |
27 Mar 19 |
nicklas |
109 |
data[4] = "Birthdate"; |
7677 |
27 Mar 19 |
nicklas |
110 |
data[5] = "Now"; |
7677 |
27 Mar 19 |
nicklas |
111 |
data[6] = "Comment"; |
7677 |
27 Mar 19 |
nicklas |
112 |
|
7677 |
27 Mar 19 |
nicklas |
113 |
styleCreator.setBaseStyle(headerStyle); |
7677 |
27 Mar 19 |
nicklas |
114 |
tw.tablePrintHeaders(data); |
7677 |
27 Mar 19 |
nicklas |
115 |
|
7677 |
27 Mar 19 |
nicklas |
116 |
Date today = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant()); |
7677 |
27 Mar 19 |
nicklas |
117 |
Date now = new Date(); |
7677 |
27 Mar 19 |
nicklas |
118 |
|
7677 |
27 Mar 19 |
nicklas |
119 |
data[0] = "Foo source"; |
7677 |
27 Mar 19 |
nicklas |
120 |
data[1] = 1; |
7677 |
27 Mar 19 |
nicklas |
121 |
data[2] = 25; |
7677 |
27 Mar 19 |
nicklas |
122 |
data[3] = Math.PI; |
7677 |
27 Mar 19 |
nicklas |
123 |
data[4] = today; |
7677 |
27 Mar 19 |
nicklas |
124 |
data[5] = now; |
7677 |
27 Mar 19 |
nicklas |
125 |
data[6] = "Auto-formatted data line"; |
7677 |
27 Mar 19 |
nicklas |
126 |
styleCreator.setBaseStyle(null); |
7677 |
27 Mar 19 |
nicklas |
127 |
tw.tablePrintData(data); |
7677 |
27 Mar 19 |
nicklas |
128 |
|
7677 |
27 Mar 19 |
nicklas |
129 |
tw.setColumnFormatter(3, new NumberFormatter(2, true)); |
7677 |
27 Mar 19 |
nicklas |
130 |
tw.setColumnFormatter(4, new DateFormatter("yyyy-MMM-dd")); |
7832 |
24 Jun 20 |
nicklas |
131 |
tw.setColumnFormatter(5, new DateFormatter("yyyy-MMM-dd HH:mm")); |
7677 |
27 Mar 19 |
nicklas |
132 |
|
7677 |
27 Mar 19 |
nicklas |
133 |
data[0] = "Bar code"; |
7677 |
27 Mar 19 |
nicklas |
134 |
data[1] = 2; |
7677 |
27 Mar 19 |
nicklas |
135 |
data[2] = 50; |
7677 |
27 Mar 19 |
nicklas |
136 |
data[3] = Math.E; |
7677 |
27 Mar 19 |
nicklas |
137 |
data[4] = today; |
7677 |
27 Mar 19 |
nicklas |
138 |
data[5] = now; |
7677 |
27 Mar 19 |
nicklas |
139 |
data[6] = "Column formatter line"; |
7677 |
27 Mar 19 |
nicklas |
140 |
|
7677 |
27 Mar 19 |
nicklas |
141 |
tw.tablePrintData(data); |
7677 |
27 Mar 19 |
nicklas |
142 |
|
7678 |
27 Mar 19 |
nicklas |
143 |
tw.println(); |
7678 |
27 Mar 19 |
nicklas |
144 |
tw.print("Printed"); |
7678 |
27 Mar 19 |
nicklas |
145 |
tw.print(3); |
7678 |
27 Mar 19 |
nicklas |
146 |
tw.print(555); |
7678 |
27 Mar 19 |
nicklas |
147 |
tw.print(532.678f); |
7678 |
27 Mar 19 |
nicklas |
148 |
tw.print(today); |
7678 |
27 Mar 19 |
nicklas |
149 |
tw.print(now); |
7678 |
27 Mar 19 |
nicklas |
150 |
tw.println("Printed line"); |
7678 |
27 Mar 19 |
nicklas |
151 |
styleCreator.setBaseStyle(commentStyle); |
7678 |
27 Mar 19 |
nicklas |
152 |
tw.print("#End-of-file"); |
7678 |
27 Mar 19 |
nicklas |
153 |
tw.print((Object)null); |
7678 |
27 Mar 19 |
nicklas |
154 |
tw.print("<-There should be an empty cell here"); |
7678 |
27 Mar 19 |
nicklas |
155 |
|
7677 |
27 Mar 19 |
nicklas |
156 |
out = FileUtil.getOutputStream(new java.io.File(outFile)); |
7677 |
27 Mar 19 |
nicklas |
157 |
tw.saveTo(out); |
7677 |
27 Mar 19 |
nicklas |
158 |
out.close(); |
7677 |
27 Mar 19 |
nicklas |
159 |
tw.close(); |
7677 |
27 Mar 19 |
nicklas |
160 |
|
7677 |
27 Mar 19 |
nicklas |
161 |
write("--Create Excel file OK (" + outFile + ")"); |
7677 |
27 Mar 19 |
nicklas |
162 |
} |
7677 |
27 Mar 19 |
nicklas |
163 |
catch (Throwable ex) |
7677 |
27 Mar 19 |
nicklas |
164 |
{ |
7677 |
27 Mar 19 |
nicklas |
165 |
write("--Create Excel file FAILED (" + outFile + ")"); |
7677 |
27 Mar 19 |
nicklas |
166 |
ex.printStackTrace(); |
7677 |
27 Mar 19 |
nicklas |
167 |
ok = false; |
7677 |
27 Mar 19 |
nicklas |
168 |
} |
7677 |
27 Mar 19 |
nicklas |
169 |
finally |
7677 |
27 Mar 19 |
nicklas |
170 |
{ |
7728 |
14 Jun 19 |
nicklas |
171 |
FileUtil.close(workbook); |
7677 |
27 Mar 19 |
nicklas |
172 |
FileUtil.close(out); |
7677 |
27 Mar 19 |
nicklas |
173 |
} |
7677 |
27 Mar 19 |
nicklas |
174 |
} |
7677 |
27 Mar 19 |
nicklas |
175 |
|
7677 |
27 Mar 19 |
nicklas |
176 |
public static void test_read_xlsx(String inFile, String name) |
7677 |
27 Mar 19 |
nicklas |
177 |
{ |
7677 |
27 Mar 19 |
nicklas |
178 |
InputStream in = null; |
7677 |
27 Mar 19 |
nicklas |
179 |
try |
7677 |
27 Mar 19 |
nicklas |
180 |
{ |
7677 |
27 Mar 19 |
nicklas |
181 |
in = FileUtil.getInputStream(new java.io.File(inFile)); |
7677 |
27 Mar 19 |
nicklas |
182 |
|
7677 |
27 Mar 19 |
nicklas |
183 |
XlsxToCsvUtil xlsx = new XlsxToCsvUtil(); |
7677 |
27 Mar 19 |
nicklas |
184 |
xlsx.readWorkbook(in); |
7677 |
27 Mar 19 |
nicklas |
185 |
in.close(); |
7677 |
27 Mar 19 |
nicklas |
186 |
|
7677 |
27 Mar 19 |
nicklas |
187 |
if (name != null) |
7677 |
27 Mar 19 |
nicklas |
188 |
{ |
7677 |
27 Mar 19 |
nicklas |
189 |
SheetInfo sheet = xlsx.getSheetAsCsv(name); |
7677 |
27 Mar 19 |
nicklas |
190 |
in = sheet.parseToCsv(); |
7677 |
27 Mar 19 |
nicklas |
191 |
} |
7677 |
27 Mar 19 |
nicklas |
192 |
else |
7677 |
27 Mar 19 |
nicklas |
193 |
{ |
7677 |
27 Mar 19 |
nicklas |
194 |
in = xlsx.getWorkbookAsCsv(); |
7677 |
27 Mar 19 |
nicklas |
195 |
} |
7677 |
27 Mar 19 |
nicklas |
196 |
|
7677 |
27 Mar 19 |
nicklas |
197 |
BufferedReader reader = new BufferedReader(new InputStreamReader(in, xlsx.getCharset())); |
7677 |
27 Mar 19 |
nicklas |
198 |
String line = null; |
7677 |
27 Mar 19 |
nicklas |
199 |
while ((line = reader.readLine()) != null) |
7677 |
27 Mar 19 |
nicklas |
200 |
{ |
7677 |
27 Mar 19 |
nicklas |
201 |
if (!TestUtil.getSilent()) write(" " + line); |
7677 |
27 Mar 19 |
nicklas |
202 |
} |
7677 |
27 Mar 19 |
nicklas |
203 |
|
7677 |
27 Mar 19 |
nicklas |
204 |
write("--Read Excel file via XlsxToCsvUtil OK (" + inFile + ")"); |
7677 |
27 Mar 19 |
nicklas |
205 |
} |
7677 |
27 Mar 19 |
nicklas |
206 |
catch (Throwable ex) |
7677 |
27 Mar 19 |
nicklas |
207 |
{ |
7677 |
27 Mar 19 |
nicklas |
208 |
write("--Read Excel file via XlsxToCsvUtil FAILED (" + inFile + ")"); |
7677 |
27 Mar 19 |
nicklas |
209 |
ex.printStackTrace(); |
7677 |
27 Mar 19 |
nicklas |
210 |
ok = false; |
7677 |
27 Mar 19 |
nicklas |
211 |
} |
7677 |
27 Mar 19 |
nicklas |
212 |
finally |
7677 |
27 Mar 19 |
nicklas |
213 |
{ |
7677 |
27 Mar 19 |
nicklas |
214 |
FileUtil.close(in); |
7677 |
27 Mar 19 |
nicklas |
215 |
} |
7677 |
27 Mar 19 |
nicklas |
216 |
} |
7677 |
27 Mar 19 |
nicklas |
217 |
|
7677 |
27 Mar 19 |
nicklas |
218 |
public static void test_read_xlsx_via_ffp(String inFile, String name) |
7677 |
27 Mar 19 |
nicklas |
219 |
{ |
7677 |
27 Mar 19 |
nicklas |
220 |
InputStream in = null; |
7677 |
27 Mar 19 |
nicklas |
221 |
try |
7677 |
27 Mar 19 |
nicklas |
222 |
{ |
7677 |
27 Mar 19 |
nicklas |
223 |
in = FileUtil.getInputStream(new java.io.File(inFile)); |
7677 |
27 Mar 19 |
nicklas |
224 |
|
7677 |
27 Mar 19 |
nicklas |
225 |
boolean parseSections = name == null; |
7677 |
27 Mar 19 |
nicklas |
226 |
|
7677 |
27 Mar 19 |
nicklas |
227 |
FlatFileParser ffp = new FlatFileParser(); |
7677 |
27 Mar 19 |
nicklas |
228 |
ffp.setParseAllExcelSheets(parseSections); |
7677 |
27 Mar 19 |
nicklas |
229 |
ffp.setDataHeaderRegexp(Pattern.compile("Name\\t.*")); |
7677 |
27 Mar 19 |
nicklas |
230 |
ffp.setInputStream(in, name); |
7677 |
27 Mar 19 |
nicklas |
231 |
|
7677 |
27 Mar 19 |
nicklas |
232 |
while (true) |
7677 |
27 Mar 19 |
nicklas |
233 |
{ |
7677 |
27 Mar 19 |
nicklas |
234 |
if (parseSections) |
7677 |
27 Mar 19 |
nicklas |
235 |
{ |
7677 |
27 Mar 19 |
nicklas |
236 |
if (!ffp.hasMoreSections()) break; |
7677 |
27 Mar 19 |
nicklas |
237 |
Line s = ffp.nextSection(); |
7677 |
27 Mar 19 |
nicklas |
238 |
if (!TestUtil.getSilent()) write(" SECTION: " + s.line()); |
7677 |
27 Mar 19 |
nicklas |
239 |
} |
7677 |
27 Mar 19 |
nicklas |
240 |
ffp.parseHeaders(); |
7677 |
27 Mar 19 |
nicklas |
241 |
if (!TestUtil.getSilent()) |
7677 |
27 Mar 19 |
nicklas |
242 |
{ |
7677 |
27 Mar 19 |
nicklas |
243 |
write(" WORKSHEET: " + ffp.getExcelSheet()); |
7677 |
27 Mar 19 |
nicklas |
244 |
write(" HEADER:" + ffp.getLine(ffp.getLineCount()-1).line()); |
7677 |
27 Mar 19 |
nicklas |
245 |
} |
7677 |
27 Mar 19 |
nicklas |
246 |
|
7677 |
27 Mar 19 |
nicklas |
247 |
while (ffp.hasMoreData()) |
7677 |
27 Mar 19 |
nicklas |
248 |
{ |
7677 |
27 Mar 19 |
nicklas |
249 |
Data d = ffp.nextData(); |
7677 |
27 Mar 19 |
nicklas |
250 |
write(d); |
7677 |
27 Mar 19 |
nicklas |
251 |
} |
7677 |
27 Mar 19 |
nicklas |
252 |
if (!parseSections) break; |
7677 |
27 Mar 19 |
nicklas |
253 |
} |
7677 |
27 Mar 19 |
nicklas |
254 |
|
7677 |
27 Mar 19 |
nicklas |
255 |
write("--Read Excel file via FlatFileParser OK (" + inFile + ")"); |
7677 |
27 Mar 19 |
nicklas |
256 |
} |
7677 |
27 Mar 19 |
nicklas |
257 |
catch (Throwable ex) |
7677 |
27 Mar 19 |
nicklas |
258 |
{ |
7677 |
27 Mar 19 |
nicklas |
259 |
write("--Read Excel file via FlatFileParser FAILED (" + inFile + ")"); |
7677 |
27 Mar 19 |
nicklas |
260 |
ex.printStackTrace(); |
7677 |
27 Mar 19 |
nicklas |
261 |
ok = false; |
7677 |
27 Mar 19 |
nicklas |
262 |
} |
7677 |
27 Mar 19 |
nicklas |
263 |
finally |
7677 |
27 Mar 19 |
nicklas |
264 |
{ |
7677 |
27 Mar 19 |
nicklas |
265 |
FileUtil.close(in); |
7677 |
27 Mar 19 |
nicklas |
266 |
} |
7677 |
27 Mar 19 |
nicklas |
267 |
} |
7677 |
27 Mar 19 |
nicklas |
268 |
|
7677 |
27 Mar 19 |
nicklas |
269 |
|
7677 |
27 Mar 19 |
nicklas |
270 |
static void write(String message) |
7677 |
27 Mar 19 |
nicklas |
271 |
{ |
7677 |
27 Mar 19 |
nicklas |
272 |
System.out.println(message); |
7677 |
27 Mar 19 |
nicklas |
273 |
} |
7677 |
27 Mar 19 |
nicklas |
274 |
|
7677 |
27 Mar 19 |
nicklas |
275 |
static void write(Data d) |
7677 |
27 Mar 19 |
nicklas |
276 |
{ |
7677 |
27 Mar 19 |
nicklas |
277 |
StringBuilder sb = new StringBuilder(); |
7677 |
27 Mar 19 |
nicklas |
278 |
for (int i = 0; i < d.columns(); i++) |
7677 |
27 Mar 19 |
nicklas |
279 |
{ |
7677 |
27 Mar 19 |
nicklas |
280 |
sb.append("\t").append(d.getString(i)); |
7677 |
27 Mar 19 |
nicklas |
281 |
} |
7677 |
27 Mar 19 |
nicklas |
282 |
if (!TestUtil.getSilent()) write(" DATA: " + sb); |
7677 |
27 Mar 19 |
nicklas |
283 |
} |
7677 |
27 Mar 19 |
nicklas |
284 |
|
7677 |
27 Mar 19 |
nicklas |
285 |
} |