diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-11-28 06:53:55 -0600 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-11-28 06:54:02 -0600 |
commit | a6baa197a8a0333bc90e03a135441cacb7a133b9 (patch) | |
tree | 400a407aa0da79aca7fa3c4b2c8364267cab5eb1 /cadi | |
parent | 4c93571c67abd90c6da8b4ed0d5b93e1fe25887d (diff) |
Expire, Remove Batch, restore
Issue-ID: AAF-641
Change-Id: I3d36005d59eb466141154fb729d48d5e2763fa9d
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.java | 36 |
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 c7fada74..ed4fcde6 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 @@ -138,33 +138,41 @@ public class CSV { private Writer(final boolean append) throws FileNotFoundException { ps = new PrintStream(new FileOutputStream(csv,append)); } - 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 |