: bw.getSize(entity, entityClass, entityType, EMPTY_ANNOTATIONS, mediaType);
listener.onRequestEntitySize(size);
final OutputStream out = ro.getAdapter().adapt(ro, listener.onGetOutputStream());
try {
bw.writeTo(entity, entityClass, entityType,
EMPTY_ANNOTATIONS, mediaType, headers, out);
out.flush();
} catch (IOException ex) {
try { out.close(); } catch (Exception e) { }
throw ex;