use of org.grails.buffer.StreamCharBuffer.StreamCharBufferWriter in project grails-core by grails.
the class GSPResponseWriter method getInstance.
/**
* Static factory method to create the writer.
*
* TODO: this can be removed?
*
* @param target The target writer to write too
* @param max
* @return A GSPResponseWriter instance
*/
@SuppressWarnings("unused")
private static GSPResponseWriter getInstance(Writer target, int max) {
if (BUFFERING_ENABLED && !(target instanceof GrailsRoutablePrintWriter) && !(target instanceof StreamCharBufferWriter)) {
StreamCharBuffer streamBuffer = new StreamCharBuffer(max, 0, max);
streamBuffer.connectTo(target, false);
target = streamBuffer.getWriter();
}
if (instantiator == null) {
return new GSPResponseWriter(target);
}
GSPResponseWriter instance = (GSPResponseWriter) instantiator.newInstance();
instance.initialize(target);
return instance;
}
Aggregations