code: private static Writer unwrap(Writer out) throws IOException {
  		while(true) {
  			Class<? extends Writer> outClass = out.getClass();
  			// Note: bodyContentImplClass will be null when direct access disabled
  			if(outClass==bodyContentImplClass) {
  				try {
  					Writer writer = (Writer)writerField.get(out);
  					// When the writer field is non-null, BodyContent is pass-through and we may safely directly access the wrapped writer.
  					if(writer!=null) {
  						// Will keep looping to unwrap the wrapped out
  						out = writer;
  					} else {
  						// BodyContent is buffering, must use directly
  						return out;
  					}
  				} catch(IllegalAccessException e) {
  					throw new IOException(e);
  				}
  			} else {
  				// No unwrapping
  				return out;
  			}
  		}
  	}
docs: Unwraps a writer to expose any wrapped writer.  The wrapped writer is
  only returned when it is write-through, meaning the wrapper doesn't modify
  the data written, and writes to the wrapped writer immediately (no buffering).
  
  This is used to access the wrapped write for Catalina's implementation of
  the servlet BodyContent.  This allows implementations of BufferResult to
  more efficiently write their contents to recognized writer implementations.