@Override
            public void end() {
                final DataFormat clientFormat = (DataFormat) context.getAttribute(CLIENT_FORMAT, null);
                final DataFormat serverFormat = (DataFormat) context.getAttribute(SERVER_FORMAT, null);
                
                if (readBuffer.length() > 0) {
                    if (isValidTransformation(clientFormat, serverFormat)) {
                        DataTransformer dataTransformer = DataTransformerFactory.getDataTransformer(clientFormat, serverFormat);
                        IApimanBuffer writeBuffer = bufferFactory.createBuffer(readBuffer.length());
    
                        String data = dataTransformer.transform(new String(readBuffer.getBytes()));
                        writeBuffer.append(data);
    
                        super.write(writeBuffer);
                    } else {
                        super.write(readBuffer);
                    }
                }
                super.end();
            }
@see io.apiman.gateway.engine.policy.IDataPolicy#getRequestDataHandler(io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object)
plugins/transformation-policy/src/main/java/io/apiman/plugins/transformation_policy/TransformationPolicy.java