public String printRecord(PageReader reader, String delimiter) { StringBuilder sb = new StringBuilder(); for (Column c : schema.getColumns()) { if (c.getIndex() != 0) { sb.append(delimiter); } sb.append(printColumn(reader, c)); } return sb.toString(); }
public void add(Page page) { reader.setPage(page); while (reader.nextRecord()) { System.out.println(printer.printRecord(reader, ",")); } }
public PagePrinter(final Schema schema, final String timeZoneId) { this.schema = schema; this.timestampFormatters = new TimestampFormatter[schema.getColumnCount()]; for (int i = 0; i < timestampFormatters.length; i++) { if (schema.getColumnType(i) instanceof TimestampType) { TimestampType type = (TimestampType) schema.getColumnType(i); timestampFormatters[i] = TimestampFormatter.of( getFormatFromTimestampTypeWithDeprecationSuppressed(type), timeZoneId); } } this.record = new ArrayList<String>(schema.getColumnCount()); for (int i = 0; i < schema.getColumnCount(); i++) { record.add(""); } }
private final PagePrinter printer = new PagePrinter(schema, task.getTimeZoneId());
@Deprecated // https://github.com/embulk/embulk/issues/937 @SuppressWarnings("deprecation") public PagePrinter(final Schema schema, final org.joda.time.DateTimeZone timezone) { this.schema = schema; this.timestampFormatters = new TimestampFormatter[schema.getColumnCount()]; for (int i = 0; i < timestampFormatters.length; i++) { if (schema.getColumnType(i) instanceof TimestampType) { TimestampType type = (TimestampType) schema.getColumnType(i); // Constructor of TimestampFormatter is deprecated. timestampFormatters[i] = new TimestampFormatter( getFormatFromTimestampTypeWithDeprecationSuppressed(type), timezone); } } this.record = new ArrayList<String>(schema.getColumnCount()); for (int i = 0; i < schema.getColumnCount(); i++) { record.add(""); } }
public List<String> printRecord(PageReader reader) { for (Column c : schema.getColumns()) { record.set(c.getIndex(), printColumn(reader, c)); } return record; }