summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-11-28 07:27:36 -0600
committerInstrumental <jonathan.gathman@att.com>2018-11-28 07:28:30 -0600
commit71dee0333854f9ca9da53c5beff4c9a337cf9af9 (patch)
tree326aefdd7050b9a6eb7aa3904f07ba27ee829f07 /cadi
parent45de174a276923393547ac0ede25943d08dedf08 (diff)
Expire, Remove Batch, restore
Issue-ID: AAF-641 Change-Id: I06560c8252ed27bd474ea140c6d9cacef88ef1b9 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi')
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
index 4ae68310..89bb3028 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
@@ -134,33 +134,41 @@ public class CSV {
private Writer() throws FileNotFoundException {
ps = new PrintStream(new FileOutputStream(csv));
}
- public void row(Object ... strings) {
- if(strings.length>0) {
+ public void row(Object ... objs) {
+ if(objs.length>0) {
boolean first = true;
- boolean quote;
- String s;
- for(Object o : strings) {
+ for(Object o : objs) {
if(first) {
first = false;
} else {
ps.append(',');
}
- s = o.toString();
- quote = s.matches(".*[,|\"].*");
- if(quote) {
- ps.append('"');
- ps.print(s.replace("\"", "\"\"")
- .replace("'", "''")
- .replace("\\", "\\\\"));
- ps.append('"');
+ if(o instanceof String[]) {
+ for(String str : (String[])o) {
+ print(str);
+ }
} else {
- ps.append(s);
+ print(o.toString());
}
}
ps.println();
}
}
+ private void print(String s) {
+ boolean quote = s.matches(".*[,|\"].*");
+ if(quote) {
+ ps.append('"');
+ ps.print(s.replace("\"", "\"\"")
+ .replace("'", "''")
+ .replace("\\", "\\\\"));
+ ps.append('"');
+ } else {
+ ps.append(s);
+ }
+
+
+ }
/**
* Note: CSV files do not actually support Comments as a standard, but it is useful
* @param comment