code: public static void writeCsv(final ResultStream<GraphObject> result, final Writer out, final String propertyView) throws IOException {
  
  		final StringBuilder row      = new StringBuilder();
  		boolean headerWritten        = false;
  
  		for (final GraphObject obj : result) {
  
  			// Write column headers
  			if (!headerWritten) {
  
  				row.setLength(0);
  
  				for (PropertyKey key : obj.getPropertyKeys(propertyView)) {
  
  					row.append("\"").append(key.dbName()).append("\"").append(DEFAULT_FIELD_SEPARATOR);
  				}
  
  				// remove last ;
  				int pos = row.lastIndexOf("" + DEFAULT_FIELD_SEPARATOR);
  				if (pos >= 0) {
  
  					row.deleteCharAt(pos);
  				}
  
  				// append DOS-style line feed as defined in RFC 4180
  				out.append(row).append("\r\n");
  
  				// flush each line
  				out.flush();
  
  				headerWritten = true;
  
  			}
  
  			row.setLength(0);
  
  			for (PropertyKey key : obj.getPropertyKeys(propertyView)) {
  
  				Object value = obj.getProperty(key);
  
  				row.append("\"").append((value != null
  					? escapeForCsv(value)
  					: "")).append("\"").append(DEFAULT_FIELD_SEPARATOR);
  
  			}
  
  			// remove last ;
  			row.deleteCharAt(row.lastIndexOf("" + DEFAULT_FIELD_SEPARATOR));
  			out.append(row).append("\r\n");
  
  			// flush each line
  			out.flush();
  		}
  
  	}
docs: Write list of objects to output
  
  @param result
  @param out
  @param propertyView
  @throws IOException