void setWriter ( Writer writer ) { this . writer = writer ; if ( writer != null ) { // According to the spec, the JspWriter returned by // JspContext.pushBody(java.io.Writer writer) must behave as // though it were unbuffered. This means that its getBufferSize() // must always return 0. The implementation of // JspWriter.getBufferSize() returns the value of JspWriter's // 'bufferSize' field, which is inherited by this class. // Therefore, we simply save the current 'bufferSize' (so we can // later restore it should this BodyContentImpl ever be reused by // a call to PageContext.pushBody()) before setting it to 0. if ( bufferSize != 0 ) { bufferSizeSave = bufferSize ; bufferSize = 0 ; } } else { bufferSize = bufferSizeSave ; clearBody ( ) ; } }
Sets the writer to which all output is written .