@Override public WriteResult write(final RecordSet recordSet) throws IOException { beginRecordSet(); Record record; while ((record = recordSet.next()) != null) { write(record); } return finishRecordSet(); }
@Override public void close() throws IOException { if (encoder != null) { recycleQueue.offer(encoder); } super.close(); } }
@Override public final WriteResult finishRecordSet() throws IOException { if (!isActiveRecordSet()) { throw new IllegalStateException("Cannot finish RecordSet because no RecordSet has begun"); } final Map<String, String> attributes = onFinishRecordSet(); return WriteResult.of(recordCount, attributes == null ? Collections.emptyMap() : attributes); }
@Override public final WriteResult write(final Record record) throws IOException { final Map<String, String> attributes = writeRecord(record); return WriteResult.of(++recordCount, attributes); }
@Override public final void beginRecordSet() throws IOException { if (activeRecordSet) { throw new IllegalStateException("Cannot begin a RecordSet because a RecordSet has already begun"); } activeRecordSet = true; onBeginRecordSet(); }
@Override public final WriteResult write(final Record record) throws IOException { final Map<String, String> attributes = writeRecord(record); return WriteResult.of(++recordCount, attributes); }
@Override public final void beginRecordSet() throws IOException { if (activeRecordSet) { throw new IllegalStateException("Cannot begin a RecordSet because a RecordSet has already begun"); } activeRecordSet = true; onBeginRecordSet(); }
@Override public WriteResult write(final RecordSet recordSet) throws IOException { beginRecordSet(); Record record; while ((record = recordSet.next()) != null) { write(record); } return finishRecordSet(); }
@Override public final WriteResult finishRecordSet() throws IOException { if (!isActiveRecordSet()) { throw new IllegalStateException("Cannot finish RecordSet because no RecordSet has begun"); } final Map<String, String> attributes = onFinishRecordSet(); return WriteResult.of(recordCount, attributes == null ? Collections.emptyMap() : attributes); }
@Override public void close() throws IOException { try { writer.close(); } catch (XMLStreamException e) { throw new IOException(e.getMessage()); } super.close(); }
@Override public void close() throws IOException { if (generator != null) { generator.close(); } super.close(); }