public void execute() throws IOException {
Schema schema = null;
List<AvroGenericSource> sources = new ArrayList<>();
for (InputStream in : inputStreams) {
if (schema == null) {
AvroGenericSource source = new AvroGenericSource(in);
schema = source.getAvroSchema();
sources.add(source);
} else {
sources.add(new AvroGenericSource(in, schema));
}
}
AvroSink<GenericRecord> sink = new AvroSink<>(outputStream, schema);
for (AvroGenericSource source : sources) {
sink.appendAll(source);
source.close();
}
sink.close();
}