Batch work and client
[aaf/authz.git] / cadi / core / src / main / java / org / onap / aaf / cadi / util / CSV.java
index a834db5..a395887 100644 (file)
@@ -57,6 +57,10 @@ public class CSV {
                processAll = false;
        }
        
+       public String name() {
+               return csv.getName();
+       }
+
        public CSV processAll() {
                processAll = true;
                return this;
@@ -85,7 +89,7 @@ public class CSV {
                                        List<String> row = new ArrayList<>();
                                        boolean quotes=false;
                                        boolean escape=false;
-                                       char c;
+                                       char c = 0;
                                        for(int i=0;i<line.length();++i) {
                                                switch(c=line.charAt(i)) {
                                                        case '"':
@@ -124,7 +128,7 @@ public class CSV {
                                                                sb.append(c);
                                                }
                                        }
-                                       if(sb.length()>0) {
+                                       if(sb.length()>0 || c==',') {
                                                row.add(sb.toString());
                                                sb.setLength(0);
                                        }
@@ -197,9 +201,10 @@ public class CSV {
                 * Note: CSV files do not actually support Comments as a standard, but it is useful
                 * @param comment
                 */
-               public void comment(String comment) {
+               public void comment(String comment, Object ... objs) {
                        ps.print("# ");
-                       ps.println(comment);
+                       ps.printf(comment,objs);
+                       ps.println();
                }
                
                public void flush() {