final BinaryValue binaryValue = (BinaryValue)typedValue.getValue();
OutputStream os = null;
try {
os = response.getOutputStream();
binaryValue.streamBinaryTo(os);
} catch(final IOException ioe) {
throw new RestXqServiceException("Error while serializing binary: " + ioe.toString(), ioe);
} finally {
if(os != null) {
try {