Class ServletWriter

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Direct Known Subclasses:
    NewlineReductionServletWriter

    public class ServletWriter
    extends java.lang.Object
    implements java.lang.AutoCloseable
    This is what is used to generate servlets.
    • Constructor Summary

      Constructors 
      Constructor Description
      ServletWriter​(java.io.PrintWriter writer)
      Creates a new ServletWriter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the underlying writer.
      int getJavaLine()
      Returns the current Java line number.
      void popIndent()
      Decreases the indentation level.
      void print​(char c)
      Prints the given char.
      void print​(int i)
      Prints the given int.
      void print​(java.lang.String s)
      Prints the given string.
      void printil​(java.lang.String s)
      Prints the current indentation, and then the string, and a '\n'.
      void printin()
      Prints the current indentation
      void printin​(java.lang.String s)
      Prints the current indentation, followed by the given string
      void println()
      Prints a '\n'
      void println​(java.lang.String s)
      Prints the given string followed by '\n'
      void printMultiLn​(java.lang.String s)
      Prints the given string.
      void pushIndent()
      Increases the indentation level.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServletWriter

        public ServletWriter​(java.io.PrintWriter writer)
        Creates a new ServletWriter.
        Parameters:
        writer - the underlying PrintWriter
    • Method Detail

      • close

        public void close()
        Closes the underlying writer.
        Specified by:
        close in interface java.lang.AutoCloseable
      • getJavaLine

        public int getJavaLine()
        Returns the current Java line number.
        Returns:
        the current line number
      • pushIndent

        public void pushIndent()
        Increases the indentation level.
      • popIndent

        public void popIndent()
        Decreases the indentation level.
      • println

        public void println​(java.lang.String s)
        Prints the given string followed by '\n'
        Parameters:
        s - The string
      • println

        public void println()
        Prints a '\n'
      • printin

        public void printin()
        Prints the current indentation
      • printin

        public void printin​(java.lang.String s)
        Prints the current indentation, followed by the given string
        Parameters:
        s - The string
      • printil

        public void printil​(java.lang.String s)
        Prints the current indentation, and then the string, and a '\n'.
        Parameters:
        s - The string
      • print

        public void print​(char c)
        Prints the given char. Use println() to print a '\n'.
        Parameters:
        c - The char
      • print

        public void print​(int i)
        Prints the given int.
        Parameters:
        i - The int
      • print

        public void print​(java.lang.String s)
        Prints the given string. The string must not contain any '\n', otherwise the line count will be off.
        Parameters:
        s - The string
      • printMultiLn

        public void printMultiLn​(java.lang.String s)
        Prints the given string. If the string spans multiple lines, the line count will be adjusted accordingly.
        Parameters:
        s - The string