if ("version".equals(name)) serial.setVersion(value);
}
}
// I wonder if there's a better way...
WritableDocument wd = null;
if (output == null) {
wd = new WritableDocument(runtime, null, serial);
} else {
switch (output.getKind()) {
case URI:
URI furi = new URI(output.getUri());
String filename = furi.getPath();
FileOutputStream outfile = new FileOutputStream(filename);
wd = new WritableDocument(runtime, filename, serial, outfile);
break;
case OUTPUT_STREAM:
OutputStream outputStream = output.getOutputStream();
wd = new WritableDocument(runtime, null, serial, outputStream);
break;
default:
throw new UnsupportedOperationException(format("Unsupported output kind '%s'", output.getKind()));
}
}
try {
ReadablePipe rpipe = pipeline.readFrom(port);
while (rpipe.moreDocuments()) {
wd.write(rpipe.read());
}
} finally {
if (output != null) {
wd.close();
}
}
}
return portOutputs.containsValue(null);