use of org.grails.encoder.EncodedAppenderFactory in project grails-core by grails.
the class GSPResponseWriter method getEncodedAppender.
public EncodedAppender getEncodedAppender() {
if (buffer != null) {
return ((EncodedAppenderFactory) buffer.getWriter()).getEncodedAppender();
}
activateDestination();
Writer target = getTarget().unwrap();
if (target != this && target instanceof EncodedAppenderFactory) {
return ((EncodedAppenderFactory) target).getEncodedAppender();
}
return null;
}
use of org.grails.encoder.EncodedAppenderFactory in project grails-core by grails.
the class CodecPrintWriter method getEncodedAppender.
public EncodedAppender getEncodedAppender() {
EncodedAppender encodedAppender = ((EncodedAppenderFactory) buffer.getWriter()).getEncodedAppender();
encodedAppender.setIgnoreEncodingState(ignoreEncodingState);
return encodedAppender;
}
use of org.grails.encoder.EncodedAppenderFactory in project grails-core by grails.
the class StreamCharBuffer method writeToEncodedAppender.
private static boolean writeToEncodedAppender(StreamCharBuffer source, Writer target, EncodedAppender notAllowedAppender, boolean flush) throws IOException {
if (target instanceof EncodedAppenderFactory) {
EncodedAppenderFactory eaw = (EncodedAppenderFactory) target;
EncodedAppender appender = eaw.getEncodedAppender();
if (appender != null) {
if (appender == notAllowedAppender) {
throw new IllegalArgumentException("Cannot write buffer to itself.");
}
Encoder encoder = null;
if (target instanceof EncoderAware) {
encoder = ((EncoderAware) target).getEncoder();
}
if (encoder == null && appender instanceof EncoderAware) {
encoder = ((EncoderAware) appender).getEncoder();
}
source.encodeTo(appender, encoder);
if (flush) {
appender.flush();
}
return true;
}
}
return false;
}
Aggregations