Esempio n. 1
0
 /** close. */
 public void close() {
   try {
     csvr.close();
   } catch (Exception e) {
     throw new RuntimeException(e.getMessage());
   }
 }
Esempio n. 2
0
 /** {@inheritDoc} */
 public void write(Object obj) {
   if (null == csvr) {
     if (null == csvFormat) {
       this.csvr = new CsvWriter(new OutputStreamWriter(outputStream));
     } else {
       this.csvr = new CsvWriter(new OutputStreamWriter(outputStream), csvFormat);
     }
   }
   if (null == obj) return;
   try {
     if (obj.getClass().isArray()) {
       Object[] values = (Object[]) obj;
       String[] strValues = new String[values.length];
       for (int i = 0; i < values.length; i++) {
         strValues[i] = (null == values[i]) ? "" : values[i].toString();
       }
       csvr.write(strValues);
     } else {
       csvr.write(new String[] {obj.toString()});
     }
   } catch (Exception e) {
     throw new RuntimeException(e.getMessage());
   }
 }