Class XdocsTemplateSink.CustomPrintWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable
    Enclosing class:
    XdocsTemplateSink

    private static final class XdocsTemplateSink.CustomPrintWriter
    extends java.io.PrintWriter
    A Custom writer that only prints Unix-style newline character.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.regex.Pattern LINE_BREAK_ESCAPE
      A Regex pattern to represent all kinds of newline character.
      private static java.lang.String NEWLINE
      Unix-Style newline character.
      • Fields inherited from class java.io.PrintWriter

        out
      • Fields inherited from class java.io.Writer

        lock
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CustomPrintWriter​(java.io.Writer writer)
      Creates a new instance of this custom writer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void println()
      Enforces Unix-style newline character.
      void write​(java.lang.String line, int offset, int length)
      Unifies all newline characters to Unix-Style Newline character.
      • Methods inherited from class java.io.PrintWriter

        append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, write, write, write
      • Methods inherited from class java.io.Writer

        nullWriter
      • Methods inherited from class java.lang.Object

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

      • LINE_BREAK_ESCAPE

        private static final java.util.regex.Pattern LINE_BREAK_ESCAPE
        A Regex pattern to represent all kinds of newline character.
    • Constructor Detail

      • CustomPrintWriter

        private CustomPrintWriter​(java.io.Writer writer)
        Creates a new instance of this custom writer.
        Parameters:
        writer - not null writer to write the result
    • Method Detail

      • println

        public void println()
        Enforces Unix-style newline character.
        Overrides:
        println in class java.io.PrintWriter
      • write

        public void write​(java.lang.String line,
                          int offset,
                          int length)
        Unifies all newline characters to Unix-Style Newline character.
        Overrides:
        write in class java.io.PrintWriter
        Parameters:
        line - text that is to be written in the output file.
        offset - starting offset value for writing data.
        length - total length of string to be written.