Location location = createTempLocation(Constants.Files.TWILL_SPEC);
Writer writer = new OutputStreamWriter(location.getOutputStream(), Charsets.UTF_8);
try {
EventHandlerSpecification eventHandler = spec.getEventHandler();
if (eventHandler == null) {
eventHandler = new LogOnlyEventHandler().configure();
}
TwillSpecificationAdapter.create().toJson(
new DefaultTwillSpecification(spec.getName(), runtimeSpec, spec.getOrders(), eventHandler),
writer);