NewlineReductionServletWriter (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.jasper.compiler, class: NewlineReductionServletWriter

# Class NewlineReductionServletWriter

java.lang.Object
org.apache.jasper.compiler.ServletWriter
org.apache.jasper.compiler.NewlineReductionServletWriter

All Implemented Interfaces:
  `AutoCloseable`

public class NewlineReductionServletWriter extends ServletWriter
This class filters duplicate newlines instructions from the compiler output, and therefore from the runtime JSP. The duplicates typically happen because the compiler has multiple branches that write them, but they operate independently and don't realize that the previous output was identical. Removing these lines makes the JSP more efficient by executing fewer operations during runtime.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NewlineReductionServletWriter(PrintWriter writer)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `printil(String s)`
  Prints the current indentation, and then the string, and a '\n'.

  ### Methods inherited from class ServletWriter

  `close, getJavaLine, popIndent, print, print, print, printin, printin, println, println, printMultiLn, pushIndent`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### NewlineReductionServletWriter

    public NewlineReductionServletWriter(PrintWriter writer)

- ## Method Details

  - ### printil

    public void printil(String s)
    Description copied from class: `ServletWriter`
    Prints the current indentation, and then the string, and a '\n'.
    Overrides:
      `printil` in class `ServletWriter`
    Parameters:
      `s` - The string