com.nflabs.zeppelin.result.ResultDataStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zeppelin-zengine Show documentation
Show all versions of zeppelin-zengine Show documentation
Zengine is java framework for data analysis on Hadoop. see http://nflabs.github.io/zeppelin/#/zengine
package com.nflabs.zeppelin.result;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.ResultSet;
public class ResultDataStream extends AbstractResult{
public static final String DEFAULT_COLUMN_SEPARATOR="\t";
public static final String DEFAULT_ROW_SEPARATOR="\n";
private OutputStream out;
private String columnSep;
private String rowSep;
public ResultDataStream(ResultSet res, OutputStream out) throws ResultDataException {
this(res, -1, out, DEFAULT_COLUMN_SEPARATOR, DEFAULT_ROW_SEPARATOR);
}
public ResultDataStream(ResultSet res, OutputStream out, String columnSep, String rowSep) throws ResultDataException {
this(res, -1, out, columnSep, rowSep);
}
public ResultDataStream(ResultSet res, int max, OutputStream out) throws ResultDataException {
this(res, max, out, DEFAULT_COLUMN_SEPARATOR, DEFAULT_ROW_SEPARATOR);
}
public ResultDataStream(ResultSet res, int max, OutputStream out, String columnSep, String rowSep) throws ResultDataException {
super(res, max);
this.out = out;
this.columnSep = columnSep;
this.rowSep = rowSep;
}
@Override
protected void process(ColumnDef[] columnDef, Object[] row, long n) throws IOException {
if(n==0){
// print column def
for(int i=0; i