protected byte[] transform(byte[] b, int offset, int length) throws IOException {
AtmosphereResponse response = r.getResponse();
AsyncIOWriter a = response.getAsyncIOWriter();
try {
response.asyncIOWriter(buffer);
invokeInterceptor(response, b, offset, length);
return buffer.stream().toByteArray();
} finally {
buffer.close(null);
response.asyncIOWriter(a);